new stuff

This commit is contained in:
Emily 2020-08-18 14:58:36 +10:00
commit a5b6425af1
22 changed files with 1375 additions and 0 deletions

25
bot/commands/Core/ping.js Normal file
View file

@ -0,0 +1,25 @@
const Command = require("../../base/Command.js");
class Ping extends Command {
constructor (client) {
super(client, {
name: "ping",
description: "Latency and API response times.",
usage: "ping",
aliases: ["pong"]
});
}
async run (message, args, level) { // eslint-disable-line no-unused-vars
try {
const msg = await message.channel.send('Pinging...')
msg.edit(
`Pong! \`${msg.createdTimestamp - message.createdTimestamp}ms\` (💗 \`${Math.round(this.client.ws.ping)}ms\`)`
)
} catch (err) {
this.client.logger.err(err)
}
}
}
module.exports = Ping;

View file

@ -0,0 +1,37 @@
const Command = require("../../base/Command.js");
const Discord = require("discord.js");
class Eval extends Command {
constructor (client) {
super(client, {
description: "Evaluates arbitrary Javascript.",
usage: "eval <expression>",
aliases: ["ev"],
permLevel: "Bot Owner",
devOnly: true
});
}
async run (message, args, data) { // eslint-disable-line no-unused-vars
const code = args.join(" ");
try {
const evaled = eval(code);
const clean = await this.client.util.clean(evaled);
const MAX_CHARS = 3 + 2 + clean.length + 3;
if (MAX_CHARS > 2000) {
message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(clean), "output.txt")] });
}
message.channel.send(`\`\`\`js\n${clean}\n\`\`\``);
} catch (err) {
const e = await this.client.util.clean(err);
const MAX_CHARS = 1 + 5 + 1 + 3 + e.length + 3;
console.log(MAX_CHARS);
if (MAX_CHARS > 2000) {
return message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(e), "error.txt")] });
}
message.channel.send(`\`ERROR\` \`\`\`xl\n${e}\n\`\`\``);
}
}
}
module.exports = Eval;