JaBa/commands/Owner/reload.js

37 lines
948 B
JavaScript
Raw Normal View History

2022-01-02 00:02:00 +05:00
const Command = require("../../base/Command.js"),
i18next = require("i18next");
2021-12-10 21:39:54 +05:00
class Reload extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "reload",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["rel"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
botPermissions: [],
nsfw: false,
ownerOnly: true,
cooldown: 2000
2021-12-10 21:39:54 +05:00
});
}
2022-01-02 00:04:42 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
const command = args[0];
const cmd = this.client.commands.get(command) || this.client.commands.get(this.client.aliases.get(command));
2022-01-04 00:35:11 +05:00
if (!cmd) return message.error("owner/reload:NOT_FOUND", { search: command });
2021-12-11 01:11:50 +05:00
2021-12-10 21:39:54 +05:00
await this.client.unloadCommand(cmd.conf.location, cmd.help.name);
await this.client.loadCommand(cmd.conf.location, cmd.help.name);
2022-01-02 00:02:00 +05:00
const lang = data.guild.language || "ru-RU";
i18next.reloadResources(lang);
2021-12-26 19:29:37 +05:00
message.success("owner/reload:SUCCESS", {
command: cmd.help.name
});
2021-12-10 21:39:54 +05:00
}
2021-12-11 01:11:50 +05:00
};
2021-12-10 21:39:54 +05:00
module.exports = Reload;