diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-24 15:39:43 +0000 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-24 15:39:43 +0000 |
commit | 7f50d63e5245f5d1c048ef39169e6511c500ec86 (patch) | |
tree | 4b3005622410f92508322d63ec8bb1f0b584ef6e /src/commands | |
parent | a1192e580ead59f5ff124987d08fb44d00f76c27 (diff) | |
download | tanzanite-7f50d63e5245f5d1c048ef39169e6511c500ec86.tar.gz tanzanite-7f50d63e5245f5d1c048ef39169e6511c500ec86.tar.bz2 tanzanite-7f50d63e5245f5d1c048ef39169e6511c500ec86.zip |
fix(UuidCommand): slash command ign undefined
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/utilities/uuid.ts | 10 |
1 files changed, 6 insertions, 4 deletions
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)}.`); } } } |