Adding a MSG and ACTION commands

This commit is contained in:
Elijah Lazkani 2017-09-10 23:53:28 -04:00
parent 39ea93c632
commit 2b1dc33e47
2 changed files with 13 additions and 2 deletions

View file

@ -17,7 +17,7 @@ It will only answer to the `keyword` provided to the `Eightball` object.
# Admin # Admin
The `Admin` module provides the ability to add bot administrators who can request some destructive actions that might put the bot itself being abused like `join`, `part` and `quit`. The `Admin` module provides the ability to add bot administrators who can request some destructive actions that might put the bot itself being abused like `msg`, `action`, `join`, `part` and `quit`.
## Commands ## Commands

View file

@ -29,6 +29,18 @@ async def plugins(bot: robot.Bot):
def part(target, message, **kwargs): def part(target, message, **kwargs):
bot.send("PART", channel=message) bot.send("PART", channel=message)
@admin_cmd.on_command("msg")
def msg(target, message, **kwargs):
kwargs['target'] = message.split(' ')[0]
kwargs['message'] = " ".join(message.split(' ')[1:])
bot.send("PRIVMSG", **kwargs)
@admin_cmd.on_command("action")
def action(target, message, **kwargs):
kwargs['target'] = message.split(' ')[0]
kwargs['message'] = "\x01ACTION {}\x01".format(" ".join(message.split(' ')[1:]))
bot.send("PRIVMSG", **kwargs)
@admin_cmd.on_command("quit") @admin_cmd.on_command("quit")
async def quit(target, message, **kwargs): async def quit(target, message, **kwargs):
bot.send("QUIT", message=message) bot.send("QUIT", message=message)
@ -36,7 +48,6 @@ async def plugins(bot: robot.Bot):
# Exit the event loop cleanly # Exit the event loop cleanly
bot.loop.stop() bot.loop.stop()
def main(): def main():
host = 'eu.undernet.org' host = 'eu.undernet.org'