operator help: complete + context-aware (ops-17): !bot help full grouped list, !help for everyone per-channel
This commit is contained in:
@@ -182,6 +182,9 @@ class FjerkroaBot(commands.Bot):
|
||||
if content.startswith("!privacy"):
|
||||
await message.channel.send(self.config.get("privacy-notice", DEFAULT_PRIVACY_NOTICE), suppress_embeds=True)
|
||||
return
|
||||
if content.startswith("!help"): # OPS-17: context-aware, works even while paused
|
||||
await message.channel.send(self._help_text(staff=self.is_staff_channel(message.channel)), suppress_embeds=True)
|
||||
return
|
||||
if not self.replies_allowed():
|
||||
return
|
||||
if str(message.content).startswith("!wichtel"):
|
||||
@@ -263,15 +266,35 @@ class FjerkroaBot(commands.Bot):
|
||||
return f"Cancelled {store.task_set_state(int(args[1]), 'cancelled')} task(s)."
|
||||
return None
|
||||
|
||||
def _help_text(self, staff: bool) -> str:
|
||||
"""Context-aware command help (OPS-17): every channel lists the user commands; the staff channel also lists operator commands."""
|
||||
everywhere = (
|
||||
"Available to everyone, in any channel:\n"
|
||||
"• `!help` — this help\n"
|
||||
"• `!forgetme` — delete your messages and memory traces (works even while I'm paused)\n"
|
||||
"• `!privacy` — how your data is handled (works even while I'm paused)\n"
|
||||
"• `!wichtel @a @b @c …` — draw Secret Santa pairings (needs ≥2 mentions; only while I'm active)"
|
||||
)
|
||||
if not staff:
|
||||
return everywhere
|
||||
operator = (
|
||||
"Staff commands — this channel only, prefixed `!bot`:\n"
|
||||
"• Control: `pause`, `resume`, `quiet <minutes>`, `status`\n"
|
||||
"• Cost: `spend`, `images on|off`\n"
|
||||
"• Memory: `memory <user>`, `forget-fact <id>`, `pin <channel|global> <text>`, `unpin <id>`, `pins`\n"
|
||||
"• Tasks: `tasks` (list), `tasks on|off`, `task-approve <id>`, `task-cancel <id>`"
|
||||
)
|
||||
return operator + "\n\n" + everywhere
|
||||
|
||||
async def handle_staff_command(self, message: Message) -> None:
|
||||
"""Operator kill-switches, staff channel only (OPS-01..05, OPS-09, MEM-07)."""
|
||||
"""Operator kill-switches, staff channel only (OPS-01..05, OPS-09, OPS-17, MEM-07)."""
|
||||
args = str(message.content).split()[1:]
|
||||
for handler in (self._memory_command, self._task_command):
|
||||
reply = handler(args)
|
||||
if reply is not None:
|
||||
await message.channel.send(reply, suppress_embeds=True)
|
||||
return
|
||||
reply = "Commands: pause, resume, images on|off, tasks on|off, quiet <minutes>, status, spend, memory <user>, forget-fact <id>, pin <channel|global> <fact>, unpin <id>"
|
||||
reply = self._help_text(staff=True) # OPS-17: unknown/`help` -> full grouped help
|
||||
if args[:1] == ["pause"]:
|
||||
self.replies_enabled = False
|
||||
reply = "Replies paused."
|
||||
|
||||
Reference in New Issue
Block a user