feat: add Discord help command for servers and DMs
This commit is contained in:
22
src/discord/help.ts
Normal file
22
src/discord/help.ts
Normal 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}/` }] }],
|
||||
} };
|
||||
}
|
||||
Reference in New Issue
Block a user