This commit is contained in:
Christer Warén
2023-11-28 22:55:11 +02:00
parent 2a7dca38f2
commit 32fabe63ff
6 changed files with 19 additions and 11 deletions

View File

@ -8,7 +8,9 @@ export default {
category: 'radio',
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: command) {
if (client.funcs.check(client, interaction, command)) {
if(!interaction.guild) return;
const radio = client.radio?.get(interaction.guild?.id);
if(!radio) return;
client.statistics?.update(client, interaction.guild, radio);
radio.connection?.destroy();
client.funcs.logger('Radio', interaction.guild?.id + " / " + 'Stop');
@ -28,9 +30,9 @@ export default {
});
if(!radio.message){
radio.message = radio.textChannel.send({ embeds: [embed], components: [] });
radio.message = await radio.textChannel?.send({ embeds: [embed], components: [] }) ?? null;
} else {
if(radio.textChannel.id == radio.message.channel.id){
if(radio.textChannel?.id == radio.message.channel.id){
radio.message.edit({ embeds: [embed], components: [] });
} else {
radio.message?.delete();
@ -41,7 +43,7 @@ export default {
await radio.message?.delete();
}, 5000);
client.radio?.delete(interaction.guild?.id);
client.radio?.delete(interaction.guild.id);
interaction.reply({
content: client.messages.emojis["stop"] + client.messages.stop,