From 7f50d63e5245f5d1c048ef39169e6511c500ec86 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 24 Feb 2022 15:39:43 +0000 Subject: fix(UuidCommand): slash command ign undefined --- src/commands/utilities/uuid.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 4df9132..3699478 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -37,15 +37,17 @@ export default class UuidCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, - { ign, dashed }: { ign: { match: RegExpMatchArray; matches: any[] }; dashed: boolean } + { ign, dashed }: { ign: { match: RegExpMatchArray; matches?: any[] } | string; dashed: boolean } ) { - if (!ign) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`); + if (typeof ign === 'string') ign = { match: /\w{1,16}/im.exec(ign)! }; + + if (!ign || !ign.match) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`); const readableIGN = ign.match[0]; try { const uuid = await util.mcUUID(readableIGN, dashed); - return await message.util.reply(`The uuid for \`${readableIGN}\` is \`${uuid}\``); + return await message.util.reply(`The uuid for ${util.format.input(readableIGN)} is ${util.format.input(uuid)}`); } catch (e) { - return await message.util.reply(`${util.emojis.error} Could not find an uuid for \`${readableIGN}\`.`); + return await message.util.reply(`${util.emojis.error} Could not find an uuid for ${util.format.input(readableIGN)}.`); } } } -- cgit