2016-05-17 15:14:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Module(object):
|
2018-09-02 18:54:45 +00:00
|
|
|
def __init__(self, bot, events, exports):
|
2016-05-17 15:14:23 +00:00
|
|
|
self.bot = bot
|
2018-09-03 17:21:13 +00:00
|
|
|
events.on("received.command.changenickname").hook(
|
|
|
|
self.change_nickname, permission="changenickname",
|
2016-05-17 15:14:23 +00:00
|
|
|
min_args=1, help="Change my nickname", usage="<nickname>")
|
2018-09-03 17:21:13 +00:00
|
|
|
events.on("received.command.raw").hook(self.raw,
|
|
|
|
permission="raw", min_args=1, usage="<raw line>",
|
|
|
|
help="Send a raw IRC line through the bot")
|
|
|
|
events.on("received.command.part").hook(self.part,
|
|
|
|
permission="part", min_args=1, help="Part from a channel",
|
2016-06-24 08:17:27 +00:00
|
|
|
usage="<#channel>")
|
2018-09-03 17:21:13 +00:00
|
|
|
events.on("received.command.reconnect").hook(self.reconnect,
|
|
|
|
permission="reconnect", help="Reconnect from this network")
|
2016-05-17 15:14:23 +00:00
|
|
|
|
|
|
|
def change_nickname(self, event):
|
|
|
|
nickname = event["args_split"][0]
|
|
|
|
event["server"].send_nick(nickname)
|
|
|
|
|
|
|
|
def raw(self, event):
|
|
|
|
event["server"].send(event["args"])
|
2016-06-24 08:17:27 +00:00
|
|
|
|
|
|
|
def part(self, event):
|
|
|
|
event["server"].send_part(event["args_split"][0])
|
2018-09-03 17:21:13 +00:00
|
|
|
|
|
|
|
def reconnect(self, event):
|
|
|
|
event["server"].send_quit("Reconnecting")
|