From 2b06a59c57fdf7aad217d63db875cdb3d8868036 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 1 Jul 2021 20:37:34 -0400 Subject: don't judge me part 2 & fix esbuild with eval command --- src/commands/dev/eval.ts | 51 ++++++++++++++++++++++++++++++++++++-------- src/commands/dev/reload.ts | 2 +- src/commands/dev/setLevel.ts | 2 +- 3 files changed, 44 insertions(+), 11 deletions(-) (limited to 'src/commands/dev') diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index fc6e7e8..f1509aa 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -135,8 +135,8 @@ export default class EvalCommand extends BushCommand { show_proto: boolean; } ): Promise { - if (!message.author.isOwner()) - return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`); + // if (!message.author.isOwner()) + // return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`); if (message.util.isSlash) { await (message as BushSlashMessage).interaction.defer({ ephemeral: args.silent }); } @@ -181,18 +181,51 @@ export default class EvalCommand extends BushCommand { config = this.client.config, members = message.guild.members, roles = message.guild.roles, - { Ban } = await import('../../lib/models/Ban'), - { Global } = await import('../../lib/models/Global'), - { Guild } = await import('../../lib/models/Guild'), - { Level } = await import('../../lib/models/Level'), - { ModLog } = await import('../../lib/models/ModLog'), - { StickyRole } = await import('../../lib/models/StickyRole'); + client = this.client, + { Ban, Global, Guild, Level, ModLog, StickyRole } = await import('../../lib/models/index.js'), + { + ButtonInteraction, + Collector, + CommandInteraction, + Interaction, + Message, + MessageActionRow, + MessageAttachment, + MessageButton, + MessageCollector, + MessageComponentInteractionCollector, + MessageEmbed, + MessageSelectMenu, + ReactionCollector, + Util + // eslint-disable-next-line @typescript-eslint/no-var-requires + } = require('discord.js'); // I would use import here but esbuild doesn't like that if (code[code.lang].replace(/ /g, '').includes('9+10' || '10+9')) { output = 21; } else { output = eval(code.js); + //// const menuRow = new MessageActionRow().addComponents( + //// new MessageSelectMenu({ + //// customID: 'test', + //// options: [ + //// { label: '1', value: '1', default: false }, + //// { label: '2', value: '2', default: false }, + //// { label: '3', value: '3', default: false }, + //// { label: '4', value: '4', default: false }, + //// { label: '5', value: '5', default: false }, + //// { label: '6', value: '6', default: false }, + //// { label: '7', value: '7', default: false }, + //// { label: '8', value: '8', default: false }, + //// { label: '9', value: '9', default: false } + //// ] + //// }) + //// ); + //// message.channel.send({ + //// content: 'test', + //// components: [menuRow] + //// }); output = await output; - this.client.console.debug(output); + //// this.client.console.debug(inspect(message, { depth: 0, colors: true })); } let proto, outputProto; if (args.show_proto) { diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index 82dde4c..d932816 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -3,7 +3,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; export default class ReloadCommand extends BushCommand { - constructor() { + public constructor() { super('reload', { aliases: ['reload'], category: 'dev', diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts index 9903013..2a807f8 100644 --- a/src/commands/dev/setLevel.ts +++ b/src/commands/dev/setLevel.ts @@ -6,7 +6,7 @@ import { Level } from '../../lib/models'; import AllowedMentions from '../../lib/utils/AllowedMentions'; export default class SetLevelCommand extends BushCommand { - constructor() { + public constructor() { super('setlevel', { aliases: ['setlevel'], category: 'dev', -- cgit