From 190b2ee7eceff96207d4687e76ac00909d536df5 Mon Sep 17 00:00:00 2001 From: lucidiot Date: Thu, 23 Feb 2023 20:54:52 +0100 Subject: [PATCH] Add ops plugin --- breadbot/plugins/ops.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 breadbot/plugins/ops.py diff --git a/breadbot/plugins/ops.py b/breadbot/plugins/ops.py new file mode 100644 index 0000000..7c058da --- /dev/null +++ b/breadbot/plugins/ops.py @@ -0,0 +1,40 @@ +from pinhook import bot, plugin # type: ignore + + +@plugin.command( + '?say', + help_text='Make the bot talk.', + ops=True, + ops_msg='This is an administrators-only command.', +) +def say(ctx: bot.Bot.Message) -> None: + args = (ctx.arg or '').split(maxsplit=1) + if len(args) < 2: + return plugin.message('Usage: ?say ') + ctx.privmsg(*args) + + +@plugin.command( + '?action', + help_text='Make the bot do something (/me)', + ops=True, + ops_msg='This is an administrators-only command.', +) +def action(ctx: bot.Bot.Message) -> None: + args = (ctx.arg or '').split(maxsplit=1) + if len(args) < 2: + return plugin.message('Usage: ?action ') + ctx.action(*args) + + +@plugin.command( + '?notice', + help_text='Send a notice to someone from the bot.', + ops=True, + ops_msg='This is an administrators-only command.', +) +def notice(ctx: bot.Bot.Message) -> None: + args = (ctx.arg or '').split(maxsplit=1) + if len(args) < 2: + return plugin.message('Usage: ?notice ') + ctx.notice(*args)