Added some eco aliases and fixed eval command

This commit is contained in:
WatDuhHekBro 2020-12-15 17:29:40 -06:00
parent 4752adc7b4
commit 5b3b5d0611
2 changed files with 7 additions and 4 deletions

View file

@ -139,15 +139,16 @@ export default new Command({
description: "Evaluate code.",
usage: "<code>",
permission: Command.PERMISSIONS.BOT_OWNER,
async run($: CommonLibrary): Promise<any> {
// You have to bring everything into scope to use them. AFAIK, there isn't a more maintainable way to do this, but at least TS will let you know if anything gets removed.
async run({args, author, channel, client, guild, member, message}): Promise<any> {
try {
const code = $.args.join(" ");
const code = args.join(" ");
let evaled = eval(code);
if (typeof evaled !== "string") evaled = require("util").inspect(evaled);
$.channel.send(clean(evaled), {code: "x1"});
channel.send(clean(evaled), {code: "js", split: true});
} catch (err) {
$.channel.send(`\`ERROR\` \`\`\`x1\n${clean(err)}\n\`\`\``);
channel.send(`\`ERROR\` \`\`\`js\n${clean(err)}\n\`\`\``);
}
}
}),

View file

@ -5,6 +5,7 @@ import {isAuthorized, getMoneyEmbed, getSendEmbed, ECO_EMBED_COLOR} from "./eco-
export const DailyCommand = new Command({
description: "Pick up your daily Mons. The cooldown is per user and every 22 hours to allow for some leeway.",
aliases: ["get"],
async run({author, channel, guild}) {
if (isAuthorized(guild, channel)) {
const user = Storage.getUser(author.id);
@ -75,6 +76,7 @@ export const GuildCommand = new Command({
export const LeaderboardCommand = new Command({
description: "See the richest players.",
aliases: ["top"],
async run({guild, channel, client}) {
if (isAuthorized(guild, channel)) {
const users = Storage.users;