bitbot-3.11-fork/modules/admin.py

45 lines
1.3 KiB
Python
Raw Normal View History

from src import ModuleManager, utils
2016-05-17 15:14:23 +00:00
class Module(ModuleManager.BaseModule):
@utils.hook("received.command.changenickname", min_args=1)
2016-05-17 15:14:23 +00:00
def change_nickname(self, event):
"""
:help: Change my nickname
:usage: <nickname>
:permission: changenickname
"""
2016-05-17 15:14:23 +00:00
nickname = event["args_split"][0]
event["server"].send_nick(nickname)
@utils.hook("received.command.raw", min_args=1)
2016-05-17 15:14:23 +00:00
def raw(self, event):
"""
:help: Send a line of raw IRC data
:usage: <raw line>
:permission: raw
"""
2016-05-17 15:14:23 +00:00
event["server"].send(event["args"])
2016-06-24 08:17:27 +00:00
@utils.hook("received.command.part")
2016-06-24 08:17:27 +00:00
def part(self, event):
"""
:help: Part from the current or given channel
:usage: [channel]
:permission: part
"""
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
@utils.hook("received.command.reconnect")
2018-09-03 17:21:13 +00:00
def reconnect(self, event):
"""
:help: Reconnect to the current network
:permission: reconnect
"""
2018-09-03 17:21:13 +00:00
event["server"].send_quit("Reconnecting")