From 5f5b164e0d79039e5cc270207ef7e4a4fd3c41da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 27 Aug 2021 04:59:23 +0300 Subject: [PATCH] Updated stop.js --- src/client/commands/stop.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/client/commands/stop.js b/src/client/commands/stop.js index 12d2497..92eb4d7 100644 --- a/src/client/commands/stop.js +++ b/src/client/commands/stop.js @@ -5,15 +5,37 @@ module.exports = { usage: '', permission: 'none', category: 'radio', - execute(interaction, client, Discord, command) { + async execute(interaction, client, Discord, command) { const radio = client.radio.get(interaction.guild.id); if (client.funcs.check(client, interaction, command)) { client.funcs.statisticsUpdate(client, interaction.guild, radio); radio.connection?.destroy(); radio.audioPlayer?.stop(); client.funcs.logger('Radio', 'Stream stopped' + " / " + interaction.guild.id); + + const embed = new Discord.MessageEmbed() + .setTitle(client.user.username) + .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, '')) + .setColor(client.config.embedColor) + .addField(client.messages.nowplayingTitle, "Nothing", true) + .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); + + if(!radio.message){ + radio.message = await radio.textChannel.send({ embeds: [embed] }); + } else { + radio.message.edit({ embeds: [embed] }); + } + + setTimeout(function() { + radio.message.delete(); + }, 5000); + client.radio.delete(interaction.guild.id); - interaction.reply(client.messageEmojis["stop"] + client.messages.stop); + + interaction.reply({ + content: client.messageEmojis["stop"] + client.messages.stop, + ephemeral: true + }); } } }; \ No newline at end of file