feat: add Discord help command for servers and DMs

This commit is contained in:
syntaxbullet
2026-09-08 08:33:34 +02:00
parent 0a34142b3e
commit 2671fe0f34
5 changed files with 66 additions and 2 deletions

22
src/discord/help.ts Normal file
View File

@@ -0,0 +1,22 @@
import { commands } from './commands';
import type { Reply } from './types';
/** Use registration metadata so newly integrated commands appear automatically. */
export function help(guild: boolean, origin: string): Reply {
return { type: 4, data: {
content: [
'**Minabot help**',
'Manage the same habits here and on the website. Commands work in servers and in DMs with the bot.',
'',
...commands.map(command => `**/${command.name}** — ${command.description}`),
'',
'Start with /today, then choose a habit and use its buttons to record progress. Use the forms for amounts and other details.',
'If a control expires or progress changes elsewhere, run the command again to get fresh controls.',
'',
'Personal command replies in servers are visible only to you. Sharing progress requires an explicit sharing action.',
].join('\n'),
...(guild ? { flags: 64 } : {}),
allowed_mentions: { parse: [] },
components: [{ type: 1, components: [{ type: 2, style: 5, label: 'Open website', url: `${origin}/` }] }],
} };
}