2021-01-26 14:03:02 -06:00
|
|
|
module.exports = {
|
2022-04-18 11:25:40 -05:00
|
|
|
|
|
|
|
name: require('path').parse(__filename).name,
|
2022-03-29 18:53:55 -05:00
|
|
|
description: 'Restarts the bot',
|
2022-04-21 20:53:03 -05:00
|
|
|
options: [],
|
2022-04-21 18:09:21 -05:00
|
|
|
|
2022-04-23 13:07:50 -05:00
|
|
|
async parseMessage (client, config, message) {
|
2022-07-01 19:34:46 -05:00
|
|
|
await this.handle(client, config, message.author, message.channel);
|
2022-04-21 23:44:02 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
async parseInteraction (client, config, interaction) {
|
2022-07-01 19:34:46 -05:00
|
|
|
await this.handle(client, config, interaction.user, interaction.channel);
|
2022-04-21 23:44:02 -05:00
|
|
|
},
|
|
|
|
|
2022-07-01 19:34:46 -05:00
|
|
|
async handle (client, config, user, channel) {
|
2022-08-02 23:53:10 -05:00
|
|
|
if (user.id === process.env.OWNERID) {
|
2022-07-01 19:34:46 -05:00
|
|
|
const embeds = [{
|
2022-07-28 21:10:39 -05:00
|
|
|
title: '<a:AnitroxWorking:997565411212144730> Restart Bot',
|
2022-12-26 16:28:19 -06:00
|
|
|
description: '<a:AnitroxWorking:997565411212144730> Restarting now, Be back in a minute!',
|
2022-07-01 19:34:46 -05:00
|
|
|
color: 9442302,
|
|
|
|
footer: {
|
|
|
|
icon_url: user.displayAvatarURL(),
|
|
|
|
text: config.footerTxt
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
console.log('[SYSTEM] [INFO] Restarting now!');
|
|
|
|
const response = await channel.send({ embeds });
|
2022-03-26 03:33:18 -05:00
|
|
|
try {
|
|
|
|
client.destroy();
|
2022-08-02 23:53:10 -05:00
|
|
|
await client.login(process.env.TOKEN);
|
2022-07-01 19:34:46 -05:00
|
|
|
console.log('[SYSTEM] [INFO] Restarted successfully!');
|
|
|
|
await response.edit({
|
|
|
|
embeds: [{
|
2022-08-02 23:53:10 -05:00
|
|
|
title: ':white_check_mark: Restart Bot',
|
2022-07-01 19:34:46 -05:00
|
|
|
description: 'Restarted!',
|
|
|
|
color: 9442302,
|
|
|
|
footer: {
|
|
|
|
icon_url: user.displayAvatarURL(),
|
|
|
|
text: config.footerTxt
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
});
|
2022-04-21 23:44:02 -05:00
|
|
|
} catch (e) { console.error(e); }
|
2022-03-26 03:33:18 -05:00
|
|
|
} else {
|
2022-07-01 19:34:46 -05:00
|
|
|
console.error('[SYSTEM] [ERR] User ' + user.username + " tried to restart the bot, but doesn't have permission! If this was you, Check your config.json");
|
2022-07-03 18:13:35 -05:00
|
|
|
await channel.send(client.generateErrorMessage('You do not have permission to run this command.', user.displayAvatarURL()));
|
2022-03-26 03:33:18 -05:00
|
|
|
}
|
|
|
|
}
|
2022-04-21 18:09:21 -05:00
|
|
|
};
|