From 342b01c7f51dbe8beef1d3deb37822080ed6097f Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 1 Jan 2022 17:03:48 -0500 Subject: a few things --- src/commands/dev/javascript.ts | 2 ++ src/commands/dev/sh.ts | 2 ++ src/commands/dev/test.ts | 27 ++++++++++----------------- 3 files changed, 14 insertions(+), 17 deletions(-) (limited to 'src/commands/dev') diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index 8c5dcb4..c8113aa 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -1,6 +1,8 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import assert from 'assert'; import { MessageEmbed } from 'discord.js'; import { VM } from 'vm2'; +assert(VM); export default class JavascriptCommand extends BushCommand { public constructor() { diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index e6398b6..9956897 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -1,8 +1,10 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; +import assert from 'assert'; import chalk from 'chalk'; import { exec } from 'child_process'; import { MessageEmbed, Util } from 'discord.js'; import { promisify } from 'util'; +assert(chalk); const sh = promisify(exec); const clean = (text: string | any) => { diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 247ae20..2c4e34d 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -1,12 +1,6 @@ import { BushCommand, ButtonPaginator, type BushMessage } from '#lib'; -import { - Constants as jsConstants, - MessageActionRow, - MessageButton, - MessageEmbed, - type ApplicationCommand, - type Collection -} from 'discord.js'; +import { MessageActionRow, MessageButton, MessageEmbed, type ApplicationCommand, type Collection } from 'discord.js'; +import { MessageButtonStyles } from 'discord.js/typings/enums'; export default class TestCommand extends BushCommand { public constructor() { @@ -46,14 +40,13 @@ export default class TestCommand extends BushCommand { return await message.util.reply(responses[Math.floor(Math.random() * responses.length)]); } - const s = jsConstants.MessageButtonStyles; if (['button', 'buttons'].includes(args?.feature?.toLowerCase())) { const ButtonRow = new MessageActionRow().addComponents( - new MessageButton({ style: s.PRIMARY, customId: 'primaryButton', label: 'Primary' }), - new MessageButton({ style: s.SECONDARY, customId: 'secondaryButton', label: 'Secondary' }), - new MessageButton({ style: s.SUCCESS, customId: 'success', label: 'Success' }), - new MessageButton({ style: s.DANGER, customId: 'danger', label: 'Danger' }), - new MessageButton({ style: s.LINK, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }) + new MessageButton({ style: MessageButtonStyles.PRIMARY, customId: 'primaryButton', label: 'Primary' }), + new MessageButton({ style: MessageButtonStyles.SECONDARY, customId: 'secondaryButton', label: 'Secondary' }), + new MessageButton({ style: MessageButtonStyles.SUCCESS, customId: 'success', label: 'Success' }), + new MessageButton({ style: MessageButtonStyles.DANGER, customId: 'danger', label: 'Danger' }), + new MessageButton({ style: MessageButtonStyles.LINK, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }) ); return await message.util.reply({ content: 'buttons', components: [ButtonRow] }); } else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) { @@ -73,7 +66,7 @@ export default class TestCommand extends BushCommand { const buttonRow = new MessageActionRow().addComponents( new MessageButton({ - style: jsConstants.MessageButtonStyles.LINK, + style: MessageButtonStyles.LINK, label: 'Link', url: 'https://www.google.com/' }) @@ -86,7 +79,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new MessageButton({ - style: jsConstants.MessageButtonStyles.SECONDARY, + style: MessageButtonStyles.SECONDARY, customId: id, label: id }); @@ -132,7 +125,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new MessageButton({ - style: jsConstants.MessageButtonStyles.SECONDARY, + style: MessageButtonStyles.SECONDARY, customId: id, label: id }); -- cgit