Added support for type commands
This commit is contained in:
parent
abb422c7f1
commit
4c853ae503
3 changed files with 39 additions and 14 deletions
|
@ -5,9 +5,19 @@ const guildId = process.env.GUILD_ID;
|
|||
const token = process.env.TOKEN;
|
||||
|
||||
const commands = [
|
||||
new SlashCommandBuilder().setName('ping').setDescription('Replies with pong!'),
|
||||
new SlashCommandBuilder().setName('server').setDescription('Replies with server info!'),
|
||||
new SlashCommandBuilder().setName('user').setDescription('Replies with user info!'),
|
||||
new SlashCommandBuilder()
|
||||
.setName('generate')
|
||||
.setDescription('Generate something.')
|
||||
.addStringOption(option =>
|
||||
option.setName('type')
|
||||
.setDescription('The type of thing to generate.')
|
||||
.setRequired(true)
|
||||
.addChoices(
|
||||
{ name: 'Host', value: 'host' },
|
||||
{ name: 'Gang', value: 'gang' },
|
||||
{ name: 'Corporation', value: 'corporation' },
|
||||
)
|
||||
)
|
||||
]
|
||||
.map(command => command.toJSON());
|
||||
|
||||
|
@ -17,6 +27,10 @@ rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
|
|||
.then((data) => console.log('Removed all commands from guilds'))
|
||||
.catch(console.error);
|
||||
|
||||
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
|
||||
.then((data) => console.log(`Successfully registered ${data.length} application commands.`))
|
||||
.catch(console.error);
|
||||
rest.put(Routes.applicationCommands(clientId), { body: [] })
|
||||
.then((data) => console.log(`Removed all global commands`))
|
||||
.catch(console.error);
|
||||
|
||||
rest.put(Routes.applicationCommands(clientId), { body: commands })
|
||||
.then((data) => console.log(`Added ${data.length} commands to global`))
|
||||
.catch(console.error);
|
Loading…
Add table
Add a link
Reference in a new issue