commands!
This commit is contained in:
parent
2b01e3dc97
commit
3f09ea7f76
4 changed files with 95 additions and 2 deletions
39
bot/commands/Developer/eval.js
Normal file
39
bot/commands/Developer/eval.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
module.exports = class {
|
||||
constructor (name, category) {
|
||||
this.name = name,
|
||||
this.category = category,
|
||||
this.enabled = true,
|
||||
this.guildOnly = false,
|
||||
this.devOnly = true,
|
||||
this.aliases = [],
|
||||
this.userPerms = [],
|
||||
this.botPerms = [],
|
||||
this.cooldown = 0,
|
||||
this.help = {
|
||||
description: 'Evalutes and executes JavaScript code.',
|
||||
usage: 'eval <code>',
|
||||
examples: 'eval this.client.deleteCapitalism()'
|
||||
};
|
||||
}
|
||||
|
||||
async run (client, message, args, data) { //eslint-disable-line no-unused-vars
|
||||
const code = args.join(' ');
|
||||
try {
|
||||
const evaled = eval(code);
|
||||
const clean = await client.helpers.clean(evaled);
|
||||
const MAX_CHARS = 3 + 2 + clean.length + 3;
|
||||
if (MAX_CHARS > 2000) {
|
||||
message.channel.createMessage(undefined, { file: Buffer.from(clean), name: 'EVAL_SUCCESS.txt' });
|
||||
}
|
||||
message.channel.createMessage(`\`\`\`js\n${clean}\n\`\`\``);
|
||||
} catch (err) {
|
||||
const e = await client.helpers.clean(err);
|
||||
const MAX_CHARS = 3 + 2 + e.length + 3;
|
||||
if (MAX_CHARS > 2000) {
|
||||
return message.channel.createMessage(undefined, { file: Buffer.from(e), name: 'EVAL_ERROR.txt' });
|
||||
}
|
||||
|
||||
message.channel.createMessage(`\`\`\`xl\n${e}\n\`\`\``);
|
||||
}
|
||||
}
|
||||
};
|
24
bot/commands/Developer/reload.js
Normal file
24
bot/commands/Developer/reload.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
module.exports = class {
|
||||
constructor (name, category) {
|
||||
this.name = name,
|
||||
this.category = category,
|
||||
this.enabled = true,
|
||||
this.guildOnly = false,
|
||||
this.devOnly = true,
|
||||
this.aliases = [],
|
||||
this.userPerms = [],
|
||||
this.botPerms = [],
|
||||
this.cooldown = 0,
|
||||
this.help = {
|
||||
description: 'Reloads all commands and event modules.',
|
||||
usage: 'reload',
|
||||
examples: undefined
|
||||
};
|
||||
}
|
||||
|
||||
run (client, message, args, data) { //eslint-disable-line no-unused-vars
|
||||
client.commandLoader.reloadCommands();
|
||||
client.eventLoader.reloadEventModules();
|
||||
message.channel.createMessage('All commands and event modules have been reloaded!');
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue