Add !shutdown (admin.py)
This commit is contained in:
parent
1d48f6f19d
commit
fadd21c6d9
1 changed files with 14 additions and 0 deletions
|
@ -87,3 +87,17 @@ class Module(ModuleManager.BaseModule):
|
||||||
server = self.bot.get_server(id)
|
server = self.bot.get_server(id)
|
||||||
server.disconnect()
|
server.disconnect()
|
||||||
self.bot.disconnect(server)
|
self.bot.disconnect(server)
|
||||||
|
|
||||||
|
@utils.hook("received.command.shutdown")
|
||||||
|
def shutdown(self, event):
|
||||||
|
"""
|
||||||
|
:help: Shutdown bot
|
||||||
|
:usage: [reason]
|
||||||
|
:permission: shutdown
|
||||||
|
"""
|
||||||
|
reason = event["args"] or ""
|
||||||
|
for server in self.bot.servers:
|
||||||
|
line = server.send_quit(reason)
|
||||||
|
line.on_send(self._shutdown_hook(server))
|
||||||
|
def _shutdown_hook(self, server):
|
||||||
|
return lambda: self.bot.disconnect(server)
|
||||||
|
|
Loading…
Reference in a new issue