2018-09-26 17:27:17 +00:00
|
|
|
from src import ModuleManager, Utils
|
2016-05-17 15:14:23 +00:00
|
|
|
|
2018-09-26 17:27:17 +00:00
|
|
|
class Module(ModuleManager.BaseModule):
|
|
|
|
@Utils.hook("received.command.changenickname",
|
|
|
|
permission="changenickname", min_args=1, usage="<nickname>")
|
2016-05-17 15:14:23 +00:00
|
|
|
def change_nickname(self, event):
|
2018-09-26 17:27:17 +00:00
|
|
|
"""
|
|
|
|
Change my nickname
|
|
|
|
"""
|
2016-05-17 15:14:23 +00:00
|
|
|
nickname = event["args_split"][0]
|
|
|
|
event["server"].send_nick(nickname)
|
|
|
|
|
2018-09-26 17:27:17 +00:00
|
|
|
@Utils.hook("received.command.raw", permission="raw", min_args=1,
|
|
|
|
usage="<raw line>")
|
2016-05-17 15:14:23 +00:00
|
|
|
def raw(self, event):
|
2018-09-26 17:27:17 +00:00
|
|
|
"""
|
|
|
|
Send a line of raw IRC data
|
|
|
|
"""
|
2016-05-17 15:14:23 +00:00
|
|
|
event["server"].send(event["args"])
|
2016-06-24 08:17:27 +00:00
|
|
|
|
2018-09-26 17:27:17 +00:00
|
|
|
@Utils.hook("received.command.part", permission="part", usage="[#channel]")
|
2016-06-24 08:17:27 +00:00
|
|
|
def part(self, event):
|
2018-09-26 17:27:17 +00:00
|
|
|
"""
|
|
|
|
Part from the current or given channel
|
|
|
|
"""
|
|
|
|
if event["args"]:
|
|
|
|
target = event["args_split"][0]
|
|
|
|
elif event["is_channel"]:
|
|
|
|
target = event["target"].name
|
|
|
|
else:
|
|
|
|
event["stderr"].write("No channel provided")
|
|
|
|
event["server"].send_part(target)
|
2018-09-03 17:21:13 +00:00
|
|
|
|
2018-09-26 17:27:17 +00:00
|
|
|
@Utils.hook("received.command.reconnect", permission="reconnect")
|
2018-09-03 17:21:13 +00:00
|
|
|
def reconnect(self, event):
|
2018-09-26 17:27:17 +00:00
|
|
|
"""
|
|
|
|
Reconnect to the current network
|
|
|
|
"""
|
2018-09-03 17:21:13 +00:00
|
|
|
event["server"].send_quit("Reconnecting")
|