Add ops plugin

This commit is contained in:
lucidiot 2023-02-23 20:54:52 +01:00
parent ea6b383476
commit 190b2ee7ec
1 changed files with 40 additions and 0 deletions

40
breadbot/plugins/ops.py Normal file
View File

@ -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 <channel/user> <message>')
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 <channel/user> <message>')
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 <channel/user> <message>')
ctx.notice(*args)