diff --git a/src/client/commands.js b/src/client/commands.js index fbde5ca..464ab91 100644 --- a/src/client/commands.js +++ b/src/client/commands.js @@ -1,3 +1,4 @@ +const { SlashCommandBuilder } = require('@discordjs/builders'); const { REST } = require('@discordjs/rest'); const { Routes } = require('discord-api-types/v9'); const { token, version } = require('../config.js'); @@ -11,6 +12,10 @@ module.exports = { for (const file of commandFiles) { const command = require(`./commands/${file}`); + command.data = new SlashCommandBuilder() + .setName(command.name) + .setDescription(command.description); + if(command.options) command.data.options = command.options; commands.push(command.data.toJSON()); } diff --git a/src/client/commands/bug.js b/src/client/commands/bug.js index 93a0cac..21bb468 100644 --- a/src/client/commands/bug.js +++ b/src/client/commands/bug.js @@ -1,5 +1,3 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'bug', alias: 'none', @@ -7,9 +5,6 @@ module.exports = { description: 'Report a bug', permission: 'none', category: 'info', - data: new SlashCommandBuilder() - .setName('bug') - .setDescription('Report a bug'), async execute(interaction, client, Discord, command) { let message = {}; diff --git a/src/client/commands/help.js b/src/client/commands/help.js index 21ddf29..ed4492b 100644 --- a/src/client/commands/help.js +++ b/src/client/commands/help.js @@ -1,5 +1,3 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'help', alias: 'h', @@ -7,9 +5,6 @@ module.exports = { description: 'Get help using bot', permission: 'none', category: 'info', - data: new SlashCommandBuilder() - .setName('help') - .setDescription('Get help using bot'), execute(interaction, client, Discord, command) { let message = {}; diff --git a/src/client/commands/invite.js b/src/client/commands/invite.js index 928aa08..0de2b1a 100644 --- a/src/client/commands/invite.js +++ b/src/client/commands/invite.js @@ -1,5 +1,3 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'invite', alias: 'i', @@ -7,9 +5,6 @@ module.exports = { description: 'Invite Bot', permission: 'none', category: 'info', - data: new SlashCommandBuilder() - .setName('invite') - .setDescription('Invite Bot'), execute(interaction, client, Discord, command) { let message = {}; message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username); diff --git a/src/client/commands/list.js b/src/client/commands/list.js index 3eb7583..035f904 100644 --- a/src/client/commands/list.js +++ b/src/client/commands/list.js @@ -1,15 +1,10 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'list', alias: 'l', usage: '', - description: 'List radio stations.', + description: 'List radio stations', permission: 'none', category: 'radio', - data: new SlashCommandBuilder() - .setName('list') - .setDescription('List radio stations.'), execute(interaction, client, Discord, command) { let message = {}; if(!client.stations) { diff --git a/src/client/commands/maintenance.js b/src/client/commands/maintenance.js index 6b0c3ed..685cb1d 100644 --- a/src/client/commands/maintenance.js +++ b/src/client/commands/maintenance.js @@ -1,5 +1,3 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'maintenance', alias: 'm', @@ -7,9 +5,6 @@ module.exports = { description: 'Bot Maintenance', permission: 'none', category: 'info', - data: new SlashCommandBuilder() - .setName('maintenance') - .setDescription('Bot Maintenance'), execute(interaction, client, Discord, command) { let message = {}; diff --git a/src/client/commands/nowplaying.js b/src/client/commands/nowplaying.js index 4f5c4f9..af630aa 100644 --- a/src/client/commands/nowplaying.js +++ b/src/client/commands/nowplaying.js @@ -1,5 +1,3 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'nowplaying', alias: 'np', @@ -7,9 +5,6 @@ module.exports = { description: 'Current Radio Station', permission: 'none', category: 'radio', - data: new SlashCommandBuilder() - .setName('nowplaying') - .setDescription('Current Radio Station'), async execute(interaction, client, Discord, command) { let message = {}; const radio = client.radio.get(interaction.guild.id); diff --git a/src/client/commands/play.js b/src/client/commands/play.js index 22965bf..c695462 100644 --- a/src/client/commands/play.js +++ b/src/client/commands/play.js @@ -4,23 +4,18 @@ const { getVoiceConnection, joinVoiceChannel } = require("@discordjs/voice"); -const { SlashCommandBuilder } = require('@discordjs/builders'); const { createDiscordJSAdapter } = require("../utils/adapter"); module.exports = { name: "play", alias: "p", usage: "", - description: "Play radio.", + description: "Play radio", + options: [ + { type: "STRING", name: "query", description: "Select station", required: true} + ], permission: "none", category: "radio", - data: new SlashCommandBuilder() - .setName('play') - .setDescription('Play radio.') - .addStringOption(option => - option.setName('query') - .setDescription('Select station') - .setRequired(true)), async execute(interaction, client, Discord, command) { let message = {}; let query = interaction.options.getString("query"); diff --git a/src/client/commands/statistics.js b/src/client/commands/statistics.js index 9d42252..2cc62bd 100644 --- a/src/client/commands/statistics.js +++ b/src/client/commands/statistics.js @@ -1,15 +1,10 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'statistics', alias: 'stats', usage: '', - description: 'Show usage statistics.', + description: 'Show statistics', permission: 'none', category: 'info', - data: new SlashCommandBuilder() - .setName('statistics') - .setDescription('Show usage statistics.'), execute(interaction, client, Discord, command) { let message = {}; let stations = client.stations; diff --git a/src/client/commands/status.js b/src/client/commands/status.js index 26bc0c8..e4e7e25 100644 --- a/src/client/commands/status.js +++ b/src/client/commands/status.js @@ -1,5 +1,3 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'status', alias: 'st', @@ -7,9 +5,6 @@ module.exports = { description: 'Bot Status', permission: 'none', category: 'info', - data: new SlashCommandBuilder() - .setName('status') - .setDescription('Bot Status'), async execute(interaction, client, Discord, command) { let message = {}; diff --git a/src/client/commands/stop.js b/src/client/commands/stop.js index feb018b..d4a502d 100644 --- a/src/client/commands/stop.js +++ b/src/client/commands/stop.js @@ -1,15 +1,10 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); - module.exports = { name: 'stop', - description: 'Stop radio.', + description: 'Stop radio', alias: 's', usage: '', permission: 'none', category: 'radio', - data: new SlashCommandBuilder() - .setName('stop') - .setDescription('Stop radio.'), execute(interaction, client, Discord, command) { const radio = client.radio.get(interaction.guild.id); if (client.funcs.check(client, interaction, command)) {