master
Kit Kasune 3 years ago
parent befbbd5f8f
commit d3ff828620
  1. 37
      commands/dev/restart.js

@ -12,24 +12,23 @@ module.exports = {
}, },
help: "Fully restarts the bot. Developer-only.", help: "Fully restarts the bot. Developer-only.",
async execute(message, msg, args, cmd, prefix, mention, client) { async execute(message, msg, args, cmd, prefix, mention, client) {
if (!client.developers.includes(message.author.id)) { if (!client.developers.includes(message.author.id)) {return message.channel.send("You must be a developer in order to do that!");}
try { try {
await require('../../util/lxp/cacheloop')(client); await require('../../util/lxp/cacheloop')(client);
await require('../../util/vcloop')(client); await require('../../util/vcloop')(client);
await require('../../util/monitorloop')(client); await require('../../util/monitorloop')(client);
await message.channel.send("Cache synchronized with DB! Restarting..."); await message.channel.send("Cache synchronized with DB! Restarting...");
return cp.exec("pm2 restart natsuki", function(error, stdout, stderr) { return cp.exec("pm2 restart natsuki", function(error, stdout, stderr) {
if (error) { if (error) {
return message.channel.send({embeds: [new Discord.MessageEmbed() return message.channel.send({embeds: [new Discord.MessageEmbed()
.setTitle("Error") .setTitle("Error")
.setDescription(`\`\`\`${error}\`\`\``) .setDescription(`\`\`\`${error}\`\`\``)
.setColor("ff446a") .setColor("ff446a")
.setFooter({text: "Natsuki", iconURL: client.user.avatarURL()}) .setFooter({text: "Natsuki", iconURL: client.user.avatarURL()})
.setTimestamp()]} .setTimestamp()]}
); );
} }
}); });
} catch {return message.channel.send("There was an error in trying to do that!");} } catch {return message.channel.send("There was an error in trying to do that!");}
}
} }
}; };
Loading…
Cancel
Save