eximiabots-radiox/src/client/commands/stop.ts

51 lines
1.9 KiB
TypeScript
Raw Normal View History

2022-07-18 20:44:19 +00:00
import { EmbedBuilder } from "discord.js";
2023-06-04 01:29:42 +00:00
export default {
name: 'stop',
description: 'Stop radio',
category: 'radio',
2021-09-05 00:37:03 +00:00
async execute(interaction, client, command) {
if (client.funcs.check(client, interaction, command)) {
2021-09-09 15:52:25 +00:00
const radio = client.radio.get(interaction.guild.id);
2021-09-16 01:52:30 +00:00
client.statistics.update(client, interaction.guild, radio);
radio.connection?.destroy();
2021-09-11 14:15:27 +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()
2021-08-27 01:59:23 +00:00
.setTitle(client.user.username)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
2022-07-18 20:44:19 +00:00
.addFields({
name: client.messages.nowplayingTitle,
value: "-"
})
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({
text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')
});
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);
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-09-09 09:44:50 +00:00
};