From cc7e2d625222260f0ba0176af7a9d8435b56254e Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 7 Jul 2022 20:40:24 +0200 Subject: improve steal command formatting --- src/commands/utilities/steal.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/commands') diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts index 83ec338..3741d27 100644 --- a/src/commands/utilities/steal.ts +++ b/src/commands/utilities/steal.ts @@ -3,6 +3,7 @@ import { BushCommand, clientSendAndPermCheck, emojis, + format, OptArgType, regex, type CommandMessage, @@ -96,7 +97,7 @@ export default class StealCommand extends BushCommand { ? args.name ?? args.emoji.name ?? 'stolen_emoji' : 'stolen_emoji'; - const creationSuccess = await message.guild.emojis + const res = await message.guild.emojis .create({ attachment: image, name: emojiName, @@ -104,10 +105,12 @@ export default class StealCommand extends BushCommand { }) .catch((e: Error) => e); - if (!(creationSuccess instanceof Error)) - return await message.util.reply(`${emojis.success} You successfully stole ${creationSuccess}.`); - else { - return await message.util.reply(`${emojis.error} The was an error stealing that emoji \`${creationSuccess.message}\`.`); + if (!(res instanceof Error)) { + return await message.util.reply( + `${emojis.success} You successfully stole ${res} (${format.input(res.name ?? '[emoji has no name]')}).` + ); + } else { + return await message.util.reply(`${emojis.error} The was an error stealing that emoji: ${format.input(res.message)}.`); } } @@ -127,7 +130,7 @@ export default class StealCommand extends BushCommand { }) as Promise) : args.emoji.attachment; - const creationSuccess = await message.guild.emojis + const res = await message.guild.emojis .create({ attachment: data, name: name, @@ -135,10 +138,12 @@ export default class StealCommand extends BushCommand { }) .catch((e: Error) => e); - if (!(creationSuccess instanceof Error)) - return await message.util.reply(`${emojis.success} You successfully stole ${creationSuccess}.`); - else { - return await message.util.reply(`${emojis.error} The was an error stealing that emoji \`${creationSuccess.message}\`.`); + if (!(res instanceof Error)) { + return await message.util.reply( + `${emojis.success} You successfully stole ${res} (${format.input(res.name ?? '[emoji has no name]')}).` + ); + } else { + return await message.util.reply(`${emojis.error} The was an error stealing that emoji: ${format.input(res.message)}.`); } } } -- cgit