Initial rough working draft of v3

This commit is contained in:
Charlie Laabs
2021-12-19 16:59:13 -06:00
parent b777604bb3
commit 466c122dd2
27 changed files with 7581 additions and 1663 deletions

22
src/deploy-commands.ts Normal file
View File

@@ -0,0 +1,22 @@
import { SlashCommandBuilder } from '@discordjs/builders';
import { REST } from '@discordjs/rest';
import { Routes } from 'discord-api-types/v9';
import { config } from './config';
import { packageJson } from './util';
const helpSlashCommand = new SlashCommandBuilder()
.setName('help')
.setDescription(`How to use ${packageJson().name}`);
const commands = [helpSlashCommand.toJSON()];
export async function deployCommands(clientId: string) {
const rest = new REST({ version: '9' }).setToken(config.token);
if (config.devGuildId) {
await rest.put(Routes.applicationGuildCommands(clientId, config.devGuildId), {
body: commands,
});
} else {
await rest.put(Routes.applicationCommands(clientId), { body: commands });
}
}