merge scripts

This commit is contained in:
Ryan Cao 2022-08-24 20:11:22 +08:00
parent 01ce9ad000
commit 6785418c3c
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
3 changed files with 7 additions and 11 deletions

51
src/_reupload.ts Normal file
View file

@ -0,0 +1,51 @@
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: [],
});
console.log('Successfully deleted all application commands.');
await rest.put(Routes.applicationCommands('977174139297230888'), {
body: commands,
});
console.log('Successfully registered application commands.');
})().catch((e) => {
console.error(e);
process.exit(1);
});