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',
execute(msg, args, client, Discord, command) {
let message = {};
if(!client.funcs.isDev(client.config.devId, msg.author.id)) return msg.channel.send(client.messageEmojis["error"] + client.messages.notAllowed);
if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
}
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-06-22 22:25:45 +00:00
currentRadio.connection.destroy();
2021-08-04 10:07:48 +00:00
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-04 08:17:30 +00:00
return msg.channel.send({ embeds: [embed] });
2021-06-08 09:01:56 +00:00
}
2020-04-02 05:13:51 +00:00
};