forked from Galactic/galactic-bot
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
const { Command, Argument } = require('../../../../interfaces/');
|
|
|
|
class ReloadCommand extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
name: 'reload',
|
|
module: 'developer',
|
|
description: 'Reloads components and locales.',
|
|
restricted: true,
|
|
aliases: ['r'],
|
|
arguments: [
|
|
new Argument(client, {
|
|
name: 'language',
|
|
type: 'STRING',
|
|
types: ['FLAG'],
|
|
aliases: [ 'lang' ],
|
|
description: "Reloads the language library",
|
|
default: 'all'
|
|
})
|
|
]
|
|
});
|
|
|
|
this.client = client;
|
|
|
|
|
|
}
|
|
|
|
async execute(message, { args }) {
|
|
|
|
if (args.language) {
|
|
if (args.language.value === 'all') {
|
|
await this.client.localeLoader.loadLanguages();
|
|
return message.respond('Reloaded all languages');
|
|
} else {
|
|
try {
|
|
await this.client.localeLoader.loadLanguage(args.language.value);
|
|
return message.respond(`Reloaded locale \`${args.language.value}\``);
|
|
} catch (err) {
|
|
return message.respond(err.message);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = ReloadCommand; |