2023-06-04 21:13:15 +00:00
|
|
|
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
|
|
|
import RadioClient from "../../Client";
|
2021-09-05 00:17:21 +00:00
|
|
|
|
2023-06-04 01:29:42 +00:00
|
|
|
export default {
|
2021-08-26 15:14:15 +00:00
|
|
|
name: 'stop',
|
|
|
|
description: 'Stop radio',
|
|
|
|
category: 'radio',
|
2023-06-04 21:13:15 +00:00
|
|
|
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: any) {
|
2021-08-26 15:14:15 +00:00
|
|
|
if (client.funcs.check(client, interaction, command)) {
|
2023-06-05 22:39:35 +00:00
|
|
|
const radio = client.radio?.get(interaction.guild?.id);
|
2023-06-04 21:13:15 +00:00
|
|
|
client.statistics?.update(client, interaction.guild, radio);
|
2021-08-26 15:14:15 +00:00
|
|
|
radio.connection?.destroy();
|
2023-06-05 22:39:35 +00:00
|
|
|
client.funcs.logger('Radio', interaction.guild?.id + " / " + 'Stop');
|
2021-08-27 01:59:23 +00:00
|
|
|
|
2022-07-18 20:44:19 +00:00
|
|
|
const embed = new EmbedBuilder()
|
2023-06-05 22:39:35 +00:00
|
|
|
.setTitle(client.user?.username || "-")
|
2023-06-05 23:27:46 +00:00
|
|
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["stop"].replace(/[^0-9]+/g, ''))
|
2023-06-04 21:13:15 +00:00
|
|
|
.setColor(client.config.embedColor as ColorResolvable)
|
2022-07-18 20:44:19 +00:00
|
|
|
.addFields({
|
|
|
|
name: client.messages.nowplayingTitle,
|
|
|
|
value: "-"
|
|
|
|
})
|
2021-09-03 00:46:44 +00:00
|
|
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
2022-04-06 09:35:58 +00:00
|
|
|
.setFooter({
|
|
|
|
text: client.messages.footerText,
|
2023-06-05 23:27:46 +00:00
|
|
|
iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
|
2022-04-06 09:35:58 +00:00
|
|
|
});
|
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-09-11 15:27:12 +00:00
|
|
|
if(radio.textChannel.id == radio.message.channel.id){
|
|
|
|
radio.message.edit({ embeds: [embed], components: [] });
|
|
|
|
} else {
|
|
|
|
radio.message?.delete();
|
|
|
|
}
|
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);
|
|
|
|
|
2023-06-05 22:39:35 +00:00
|
|
|
client.radio?.delete(interaction.guild?.id);
|
2021-08-27 01:59:23 +00:00
|
|
|
|
|
|
|
interaction.reply({
|
2023-06-05 23:27:46 +00:00
|
|
|
content: client.messages.emojis["stop"] + client.messages.stop,
|
2021-08-27 01:59:23 +00:00
|
|
|
ephemeral: true
|
|
|
|
});
|
2021-08-26 15:14:15 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-09 09:44:50 +00:00
|
|
|
};
|