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-04-21 23:44:02 -05:00
|
|
|
if (user.id === config.ownerID) {
|
2022-07-01 19:34:46 -05:00
|
|
|
const embeds = [{
|
|
|
|
title: '<a:AnitroxWorking:697147309531594843> Restart Bot',
|
|
|
|
description: 'Restarting Anitrox...',
|
|
|
|
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-03-29 13:55:44 -05:00
|
|
|
await client.login(config.token);
|
2022-07-01 19:34:46 -05:00
|
|
|
console.log('[SYSTEM] [INFO] Restarted successfully!');
|
|
|
|
await response.edit({
|
|
|
|
embeds: [{
|
|
|
|
title: '<a:AnitroxWorking:697147309531594843> Restart Bot',
|
|
|
|
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");
|
|
|
|
return client.generateErrorMessage('Only the bot owner can restart the bot! Stop.', user.displayAvatarURL());
|
2022-03-26 03:33:18 -05:00
|
|
|
}
|
|
|
|
}
|
2022-04-21 18:09:21 -05:00
|
|
|
};
|