eximiabots-radiox/src/client/commands/maintenance.js

53 lines
2.6 KiB
JavaScript
Raw Normal View History

2021-06-08 09:01:56 +00:00
module.exports = {
name: 'maintenance',
alias: 'm',
usage: '',
description: 'Bot Maintenance',
permission: 'none',
category: 'info',
2021-08-18 22:52:16 +00:00
execute(interaction, client, Discord, command) {
2021-06-08 09:01:56 +00:00
let message = {};
2021-08-18 22:52:16 +00:00
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply(client.messageEmojis["error"] + client.messages.notAllowed);
2021-06-08 09:01:56 +00:00
if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
2021-08-18 22:52:16 +00:00
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
2021-06-08 09:01:56 +00:00
}
let currentRadios = client.radio.keys();
let radio = currentRadios.next();
let stoppedRadios = "";
client.user.setStatus('dnd');
while (!radio.done) {
let currentRadio = client.radio.get(radio.value);
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
if(currentRadio){
client.funcs.statisticsUpdate(client, currentRadio.currentGuild.guild, currentRadio);
2021-08-22 17:49:43 +00:00
currentRadio.connection?.destroy();
currentRadio.audioPlayer?.stop();
2021-06-08 09:01:56 +00:00
const cembed = new Discord.MessageEmbed()
.setTitle(client.messages.maintenanceTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription(client.messages.sendedMaintenanceMessage)
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
2021-08-04 08:17:30 +00:00
currentRadio.textChannel.send({ embeds: [cembed] });
2021-06-08 09:01:56 +00:00
client.radio.delete(radio.value);
stoppedRadios += "-" + radio.value + ": " + currentRadio.currentGuild.guild.name + "\n";
}
radio = currentRadios.next();
}
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.maintenanceTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
2021-08-18 22:52:16 +00:00
return interaction.reply({ embeds: [embed] });
2021-06-08 09:01:56 +00:00
}
2020-04-02 05:13:51 +00:00
};