aboutsummaryrefslogtreecommitdiff
path: root/modules/perform.py
blob: c22b8b5256162ed6dbb9661542e9731263281afa (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Module(object):
    def __init__(self, bot):
        bot.events.on("received").on("numeric").on("001").hook(
            self.on_connect)

    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)