aboutsummaryrefslogtreecommitdiff
path: root/modules/perform.py
blob: cfae1d47663abf0fa43e95aaa92796a03ebddba6 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
from src import EventManager, ModuleManager, utils

class Module(ModuleManager.BaseModule):
    @utils.hook("received.numeric.001", priority=EventManager.PRIORITY_URGENT)
    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)
            command = "%".join(command)
            event["server"].send(command)