2022-06-16 09:18:39 +02:00
|
|
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
|
|
|
const { REST } = require('@discordjs/rest');
|
|
|
|
const { Routes } = require('discord-api-types/v9');
|
|
|
|
require('dotenv').config();
|
|
|
|
const { clientId, guildId, token } = process.env;
|
|
|
|
|
|
|
|
const commands = [
|
|
|
|
new SlashCommandBuilder()
|
|
|
|
.setName('ping')
|
|
|
|
.setDescription('Replies with pong!'),
|
|
|
|
|
|
|
|
new SlashCommandBuilder()
|
|
|
|
.setName('download')
|
|
|
|
.setDescription('Download a video. (100 mb max)')
|
|
|
|
.addStringOption(option =>
|
|
|
|
option.setName('url')
|
|
|
|
.setDescription('URL of the video you want to download.')
|
|
|
|
.setRequired(true))
|
|
|
|
.addBooleanOption(option =>
|
|
|
|
option.setName('advanced')
|
|
|
|
.setDescription('Choose the quality of the video.')
|
|
|
|
.setRequired(false)),
|
2022-06-17 01:25:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
new SlashCommandBuilder()
|
|
|
|
.setName('reddit')
|
|
|
|
.setDescription('Send random images from the subreddit you choose')
|
|
|
|
.addStringOption(option =>
|
|
|
|
option.setName('subreddit')
|
|
|
|
.setDescription('The subreddit you wish to see')
|
|
|
|
.setRequired(true)),
|
|
|
|
|
|
|
|
new SlashCommandBuilder()
|
|
|
|
.setName('vid2gif')
|
|
|
|
.setDescription('Convert your video into a gif.')
|
|
|
|
.addStringOption(option =>
|
|
|
|
option.setName('url')
|
|
|
|
.setDescription('URL of the video you want to convert')
|
|
|
|
.setRequired(true)),
|
2022-06-17 12:50:07 +02:00
|
|
|
|
|
|
|
new SlashCommandBuilder()
|
|
|
|
.setName('feedback')
|
|
|
|
.setDescription('Send a feedback to the developer.')
|
|
|
|
.addStringOption(option =>
|
|
|
|
option.setName('feedback')
|
|
|
|
.setDescription('The message you want to send me.')
|
|
|
|
.setRequired(true)),
|
2022-06-20 11:42:12 +02:00
|
|
|
|
|
|
|
new SlashCommandBuilder()
|
|
|
|
.setName('inspirobot')
|
|
|
|
.setDescription('Get an image from inspirobot'),
|
2022-06-16 09:18:39 +02:00
|
|
|
]
|
|
|
|
.map(command => command.toJSON());
|
|
|
|
|
|
|
|
const rest = new REST({ version: '9' }).setToken(token);
|
|
|
|
|
2022-06-17 02:08:32 +02:00
|
|
|
if (process.argv[2] === 'global') {
|
|
|
|
rest.put(Routes.applicationCommands(clientId), { body: commands })
|
2022-06-17 02:14:14 +02:00
|
|
|
.then(() => console.log('Successfully registered application commands globally.'))
|
|
|
|
.catch(console.error);
|
2022-06-17 02:08:32 +02:00
|
|
|
}
|
|
|
|
|
2022-06-16 09:18:39 +02:00
|
|
|
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
|
2022-06-17 02:08:32 +02:00
|
|
|
.then(() => console.log(`Successfully registered application commands for the guild ${guildId}.`))
|
2022-06-16 09:18:39 +02:00
|
|
|
.catch(console.error);
|