From 534bc74936f448ff4d99c3aafed6c2d14b0df0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sun, 5 Sep 2021 03:37:03 +0300 Subject: [PATCH] Updated code --- src/client/commands/next.js | 19 ++++--------------- src/client/commands/nowplaying.js | 2 +- src/client/commands/prev.js | 17 +++-------------- src/client/commands/stop.js | 2 +- src/client/events/interactionCreate.js | 2 +- 5 files changed, 10 insertions(+), 32 deletions(-) diff --git a/src/client/commands/next.js b/src/client/commands/next.js index 3570995..c49d8b6 100644 --- a/src/client/commands/next.js +++ b/src/client/commands/next.js @@ -3,21 +3,10 @@ module.exports = { description: 'Next Station', permission: 'none', category: 'info', - async execute(interaction, client) { - let message = {}; - const radio = client.radio.get(interaction.guild.id); - if (!radio) return interaction.reply({ - content: 'There is nothing playing.', - ephemeral: true - }); - if(!client.stations) { - message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); - return interaction.reply({ - content: client.messageEmojis["error"] + message.errorToGetPlaylist, - ephemeral: true - }); + async execute(interaction, client, command) { + if (client.funcs.check(client, interaction, command)) { + const radio = client.radio.get(interaction.guild.id); + console.log(client.stations.find(station => station.name == radio.station.name)); } - - } } \ No newline at end of file diff --git a/src/client/commands/nowplaying.js b/src/client/commands/nowplaying.js index df0328f..e6b2e62 100644 --- a/src/client/commands/nowplaying.js +++ b/src/client/commands/nowplaying.js @@ -5,7 +5,7 @@ module.exports = { description: 'Current Radio Station', permission: 'none', category: 'radio', - async execute(interaction, client) { + async execute(interaction, client, command) { if (client.funcs.check(client, interaction, command)) { let message = {}; const radio = client.radio.get(interaction.guild.id); diff --git a/src/client/commands/prev.js b/src/client/commands/prev.js index 6b37ab7..a7646e2 100644 --- a/src/client/commands/prev.js +++ b/src/client/commands/prev.js @@ -4,20 +4,9 @@ module.exports = { permission: 'none', category: 'info', async execute(interaction, client) { - let message = {}; - const radio = client.radio.get(interaction.guild.id); - if (!radio) return interaction.reply({ - content: 'There is nothing playing.', - ephemeral: true - }); - if(!client.stations) { - message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); - return interaction.reply({ - content: client.messageEmojis["error"] + message.errorToGetPlaylist, - ephemeral: true - }); + if (client.funcs.check(client, interaction, command)) { + const radio = client.radio.get(interaction.guild.id); + console.log(client.stations.find(station => station.name == radio.station.name)); } - - } } \ No newline at end of file diff --git a/src/client/commands/stop.js b/src/client/commands/stop.js index 8f09b77..9c53249 100644 --- a/src/client/commands/stop.js +++ b/src/client/commands/stop.js @@ -5,7 +5,7 @@ module.exports = { description: 'Stop radio', permission: 'none', category: 'radio', - async execute(interaction, client) { + async execute(interaction, client, command) { const radio = client.radio.get(interaction.guild.id); if (client.funcs.check(client, interaction, command)) { client.funcs.statisticsUpdate(client, interaction.guild, radio); diff --git a/src/client/events/interactionCreate.js b/src/client/events/interactionCreate.js index 4261d50..b917b3b 100644 --- a/src/client/events/interactionCreate.js +++ b/src/client/events/interactionCreate.js @@ -25,7 +25,7 @@ module.exports = { if (!command) return; try { - command.execute(interaction, client); + command.execute(interaction, client, command); } catch (error) { interaction.reply({ content: client.messages.runningCommandFailed,