Skip to content

Commit e5a0c8a

Browse files
committed
feat: add main entry point for doc commands (/mdn, /npm)
1 parent b5ef9e3 commit e5a0c8a

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/commands/docs/index.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { ApplicationCommandOptionType } from 'discord.js';
2+
import { createCommands } from '../index.js';
3+
import { type DocProvider, docProviders, executeDocCommand } from './providers.js';
4+
5+
export default createCommands(
6+
Object.entries(docProviders).map(([providerKey, providerConfig]) => ({
7+
data: {
8+
name: providerKey,
9+
description: providerConfig.commandDescription,
10+
options: [
11+
{
12+
name: 'query',
13+
type: ApplicationCommandOptionType.String,
14+
description: 'The search query',
15+
required: true,
16+
},
17+
{
18+
name: 'user',
19+
type: ApplicationCommandOptionType.User,
20+
description: 'The user to mention in the response',
21+
required: false,
22+
},
23+
],
24+
},
25+
execute: async (interaction) => executeDocCommand(providerKey as DocProvider, interaction),
26+
}))
27+
);

0 commit comments

Comments
 (0)