bitbot-3.11-fork/modules/perform.py
jesopo 8c6ab17e57 give an Exports object (actually, ExportsContex object) to each module, to
facilitate things like !set and !channelset without using the events system
2018-09-02 19:54:45 +01:00

16 lines
642 B
Python

import EventManager
class Module(object):
def __init__(self, bot, events, exports):
events.on("received").on("numeric").on("001").hook(
self.on_connect, 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"
].original_nickname)
command = "%".join(command)
event["server"].send(command)