JaBa/commands/Owner/reload.js

39 lines
1 KiB
JavaScript
Raw Normal View History

const Command = require("../../base/Command"),
i18next = require("i18next"),
autoUpdateDocs = require("../../helpers/autoUpdateDocs");
2022-01-04 02:18:28 +05:00
class Reload extends Command {
constructor(client) {
super(client, {
name: "reload",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["rel"],
memberPermissions: [],
botPermissions: [],
nsfw: false,
ownerOnly: true,
cooldown: 2000
});
}
async run(message, args, data) {
const command = args[0];
const cmd = this.client.commands.get(command) || this.client.commands.get(this.client.aliases.get(command));
2022-01-04 12:59:50 +05:00
if (!cmd) return message.error("owner/reload:NOT_FOUND", { search: command });
2022-01-04 02:18:28 +05:00
await this.client.unloadCommand(cmd.conf.location, cmd.help.name);
await this.client.loadCommand(cmd.conf.location, cmd.help.name);
2022-01-09 18:28:56 +05:00
const lang = message.guild ? data.guild.language : "ru-RU";
2022-01-04 12:59:50 +05:00
i18next.reloadResources(lang);
autoUpdateDocs.update(this.client);
2022-01-04 12:59:50 +05:00
2022-01-04 02:18:28 +05:00
message.success("owner/reload:SUCCESS", {
command: cmd.help.name
});
}
2022-01-13 00:26:23 +05:00
}
2022-01-04 02:18:28 +05:00
module.exports = Reload;