The helper bot for LHT https://lhtranslation.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Senko/bot/runtime/commands/dev/reload.js

33 lines
1.7 KiB

const Discord = require('discord.js');
const fs = require('fs');
const chalk = require('chalk');
const ora = require('ora');
const {EmbedBuilder, Collection} = require("discord.js");
module.exports = {
name: "reload",
aliases: ['relog', 'rel', 'refresh'],
help: new EmbedBuilder()
.setTitle("Help -> System Reloading")
.setDescription("Reloads the system extensions by refreshing all command and event files into client without terminating the node process.")
.addFields(
[{name: "Syntax", value: "`reload`. Optionally, specify the name or alias of a command you'd like reloaded."},
{name: "Notice", value: "This command is only available to developers."}]
),
category: 'Developer',
info: "Refresh all client commands and events and clear most of the require cache.",
syntax: '`reload`',
async run(client, message, args, cmd) {
if (!client.config.developers.includes(message.author.id)) {return message.channel.send(`You must be a ${client.config.bot.name} developer in order to do this!`);}
//if (!args.length) {
let timer = new Date().getTime();
client.warn(`${chalk.gray('Reload:')} ${chalk.white('All commands and events are being reloaded!')}\``);
client.log(`Developer ${chalk.white(message.author.username)} initiated the system refresh`, {color: '#ff4fd0', source: "info"}, 0, 1);
client.commands = new Collection();
await require('../../../startup/collect/commands')(client, true); //TODO reload events
return message.channel.send(`Done! Reloaded **${client.commands.size}** commands with **${client.aliases.size}** aliases in **${new Date().getTime() - timer}ms**`)
//}
}
};