bitbot-3.11-fork/modules/perform.py

14 lines
586 B
Python
Raw Normal View History

from src import EventManager, ModuleManager, utils
2016-03-29 11:56:58 +00:00
class Module(ModuleManager.BaseModule):
@utils.hook("received.numeric.001", priority=EventManager.PRIORITY_URGENT)
2016-03-29 11:56:58 +00:00
def on_connect(self, event):
commands = event["server"].get_setting("perform", [])
for i, command in enumerate(commands):
command = command.split("%%")
for j, part in enumerate(command[:]):
command[j] = part.replace("%nick%", event["server"
].nickname)
2016-03-29 11:56:58 +00:00
command = "%".join(command)
event["server"].send(command)