Adding a MSG and ACTION commands
This commit is contained in:
parent
39ea93c632
commit
2b1dc33e47
2 changed files with 13 additions and 2 deletions
|
@ -17,7 +17,7 @@ It will only answer to the `keyword` provided to the `Eightball` object.
|
|||
|
||||
# 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
|
||||
|
||||
|
|
|
@ -29,6 +29,18 @@ async def plugins(bot: robot.Bot):
|
|||
def part(target, message, **kwargs):
|
||||
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")
|
||||
async def quit(target, message, **kwargs):
|
||||
bot.send("QUIT", message=message)
|
||||
|
@ -36,7 +48,6 @@ async def plugins(bot: robot.Bot):
|
|||
# Exit the event loop cleanly
|
||||
bot.loop.stop()
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
host = 'eu.undernet.org'
|
||||
|
|
Loading…
Reference in a new issue