breadbot/breadbot/plugins/ops.py

41 lines
1.1 KiB
Python

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)