blob: b2e91458e62165202f3872b426f3ab28889c67db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import {REST} from '@discordjs/rest';
import {Routes} from 'discord-api-types/v10';
import Command from '../commands/index.js';
interface RegisterCommandsOnGuildOptions {
rest: REST;
applicationId: string;
guildId: string;
commands: Array<Command['slashCommand']>;
}
const registerCommandsOnGuild = async ({rest, applicationId, guildId, commands}: RegisterCommandsOnGuildOptions) => {
await rest.put(
Routes.applicationGuildCommands(applicationId, guildId),
{body: commands.map(command => command.toJSON())},
);
};
export default registerCommandsOnGuild;
|