2020-03-02 19:38:42 +00:00
|
|
|
module.exports = {
|
2021-08-26 15:14:15 +00:00
|
|
|
name: 'stop',
|
|
|
|
description: 'Stop radio',
|
|
|
|
alias: 's',
|
|
|
|
usage: '',
|
|
|
|
permission: 'none',
|
|
|
|
category: 'radio',
|
2021-08-27 01:59:23 +00:00
|
|
|
async execute(interaction, client, Discord, command) {
|
2021-08-26 15:14:15 +00:00
|
|
|
const radio = client.radio.get(interaction.guild.id);
|
|
|
|
if (client.funcs.check(client, interaction, command)) {
|
2021-08-18 22:52:16 +00:00
|
|
|
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
2021-08-26 15:14:15 +00:00
|
|
|
radio.connection?.destroy();
|
|
|
|
radio.audioPlayer?.stop();
|
|
|
|
client.funcs.logger('Radio', 'Stream stopped' + " / " + interaction.guild.id);
|
2021-08-27 01:59:23 +00:00
|
|
|
|
|
|
|
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)
|
2021-08-31 07:38:21 +00:00
|
|
|
.addField(client.messages.nowplayingTitle, "-", true)
|
2021-08-27 01:59:23 +00:00
|
|
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
2021-08-31 07:38:21 +00:00
|
|
|
|
2021-08-27 01:59:23 +00:00
|
|
|
if(!radio.message){
|
2021-09-02 11:40:55 +00:00
|
|
|
radio.message = radio.textChannel.send({ embeds: [embed], components: [] });
|
2021-08-27 01:59:23 +00:00
|
|
|
} else {
|
2021-08-31 07:38:21 +00:00
|
|
|
radio.message.edit({ embeds: [embed], components: [] });
|
2021-08-27 01:59:23 +00:00
|
|
|
}
|
|
|
|
|
2021-09-02 11:40:55 +00:00
|
|
|
setTimeout(async function() {
|
|
|
|
await radio.message?.delete();
|
2021-08-27 01:59:23 +00:00
|
|
|
}, 5000);
|
|
|
|
|
2021-08-26 15:14:15 +00:00
|
|
|
client.radio.delete(interaction.guild.id);
|
2021-08-27 01:59:23 +00:00
|
|
|
|
|
|
|
interaction.reply({
|
|
|
|
content: client.messageEmojis["stop"] + client.messages.stop,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
2021-08-26 15:14:15 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-02 07:23:25 +00:00
|
|
|
};
|