JaBa/commands/Owner/reload.js

37 lines
963 B
JavaScript
Raw Normal View History

2022-01-04 02:18:28 +05:00
const Command = require("../../base/Command.js"),
i18next = require("i18next");
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);
2022-01-04 02:18:28 +05:00
message.success("owner/reload:SUCCESS", {
command: cmd.help.name
});
}
};
module.exports = Reload;