big cleanup & use slash commands

This commit is contained in:
Ryan Cao 2022-08-24 18:32:10 +08:00
parent 386379b493
commit 01ce9ad000
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
15 changed files with 526 additions and 541 deletions

45
src/_upload.ts Normal file
View file

@ -0,0 +1,45 @@
import { SlashCommandBuilder, Routes } from 'discord.js';
import { REST } from '@discordjs/rest';
import { getTags } from './tagsTags';
import 'dotenv/config';
(async () => {
const tags = await getTags();
const commands = [
new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with pong!'),
new SlashCommandBuilder()
.setName('stars')
.setDescription('Returns GitHub stargazer count'),
new SlashCommandBuilder()
.setName('members')
.setDescription('Returns the number of members in the server'),
new SlashCommandBuilder()
.setName('rolypoly')
.setDescription('Rooooooly Pooooooly'),
new SlashCommandBuilder()
.setName('tag')
.setDescription('Send a tag')
.addStringOption((option) =>
option
.setName('name')
.setDescription('The tag name')
.setRequired(true)
.addChoices(...tags.map((b) => ({ name: b.name, value: b.name })))
),
].map((command) => command.toJSON());
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN!);
await rest.put(Routes.applicationCommands('977174139297230888'), {
body: commands,
});
console.log('Successfully registered application commands.');
})().catch((e) => {
console.error(e);
process.exit(1);
});