diff options
Diffstat (limited to 'src/commands/utilities')
-rw-r--r-- | src/commands/utilities/calculator.ts | 27 | ||||
-rw-r--r-- | src/commands/utilities/decode.ts | 14 | ||||
-rw-r--r-- | src/commands/utilities/highlight-show.ts | 36 | ||||
-rw-r--r-- | src/commands/utilities/price.ts | 14 | ||||
-rw-r--r-- | src/commands/utilities/suicide.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/wolframAlpha.ts | 29 |
6 files changed, 55 insertions, 69 deletions
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index 2204fe6..f0db916 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -39,30 +39,27 @@ export default class CalculatorCommand extends BushCommand { } public override async exec(message: CommandMessage | SlashMessage, args: { expression: string }) { - const decodedEmbed = new EmbedBuilder().addFields([ - { - name: '📥 Input', - value: await this.client.utils.inspectCleanRedactCodeblock(args.expression, 'mma') - } - ]); + const decodedEmbed = new EmbedBuilder().addFields({ + name: '📥 Input', + value: await this.client.utils.inspectCleanRedactCodeblock(args.expression, 'mma') + }); try { const calculated = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(args.expression) ? '21' : evaluate(args.expression); decodedEmbed .setTitle(`${emojis.successFull} Successfully Calculated Expression`) .setColor(colors.success) - .addFields([ - { name: '📤 Output', value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString(), 'mma') } - ]); + .addFields({ + name: '📤 Output', + value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString(), 'mma') + }); } catch (error) { decodedEmbed .setTitle(`${emojis.errorFull} Unable to Calculate Expression`) .setColor(colors.error) - .addFields([ - { - name: `📤 Error`, - value: await this.client.utils.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') - } - ]); + .addFields({ + name: `📤 Error`, + value: await this.client.utils.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') + }); } return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index 6aabeac..065e9e5 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -63,19 +63,17 @@ export default class DecodeCommand extends BushCommand { const encodeOrDecode = capitalize(message?.util?.parsed?.alias ?? 'decoded'); const decodedEmbed = new EmbedBuilder() .setTitle(`${encodeOrDecode} Information`) - .addFields([{ name: '📥 Input', value: await this.client.utils.inspectCleanRedactCodeblock(data) }]); + .addFields({ name: '📥 Input', value: await this.client.utils.inspectCleanRedactCodeblock(data) }); try { const decoded = Buffer.from(data, from).toString(to); decodedEmbed .setColor(colors.success) - .addFields([{ name: '📤 Output', value: await this.client.utils.inspectCleanRedactCodeblock(decoded) }]); + .addFields({ name: '📤 Output', value: await this.client.utils.inspectCleanRedactCodeblock(decoded) }); } catch (error) { - decodedEmbed.setColor(colors.error).addFields([ - { - name: `📤 Error ${encodeOrDecode.slice(1)}ing`, - value: await this.client.utils.inspectCleanRedactCodeblock(formatError(error)) - } - ]); + decodedEmbed.setColor(colors.error).addFields({ + name: `📤 Error ${encodeOrDecode.slice(1)}ing`, + value: await this.client.utils.inspectCleanRedactCodeblock(formatError(error)) + }); } return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts index 48b4971..301d719 100644 --- a/src/commands/utilities/highlight-show.ts +++ b/src/commands/utilities/highlight-show.ts @@ -36,27 +36,23 @@ export default class HighlightShowCommand extends BushCommand { .setColor(colors.default); if (highlight.blacklistedChannels.length) - embed.addFields([ - { - name: 'Ignored Channels', - value: highlight.blacklistedChannels - .map((c) => `<#${c}>`) - .join('\n') - .substring(0, 1024), - inline: true - } - ]); + embed.addFields({ + name: 'Ignored Channels', + value: highlight.blacklistedChannels + .map((c) => `<#${c}>`) + .join('\n') + .substring(0, 1024), + inline: true + }); if (highlight.blacklistedUsers.length) - embed.addFields([ - { - name: 'Ignored Users', - value: highlight.blacklistedUsers - .map((u) => `<@!${u}>`) - .join('\n') - .substring(0, 1024), - inline: true - } - ]); + embed.addFields({ + name: 'Ignored Users', + value: highlight.blacklistedUsers + .map((u) => `<@!${u}>`) + .join('\n') + .substring(0, 1024), + inline: true + }); return await message.util.reply({ embeds: [embed], allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index c569437..c44b47e 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -86,7 +86,7 @@ export default class PriceCommand extends BushCommand { // if its a bazaar item then it there should not be any ah data if (bazaar?.products?.[parsedItem]) { - priceEmbed.setTitle(`Bazaar Information for ${format.input(parsedItem)}`).addFields([ + priceEmbed.setTitle(`Bazaar Information for ${format.input(parsedItem)}`).addFields( { name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) }, { name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) }, { @@ -97,7 +97,7 @@ export default class PriceCommand extends BushCommand { }, { name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) }, { name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) } - ]); + ); return await message.util.reply({ embeds: [priceEmbed] }); } @@ -138,12 +138,10 @@ export default class PriceCommand extends BushCommand { } function addPrice(name: string, price: number | undefined) { if (price) - priceEmbed.addFields([ - { - name: name, - value: price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - } - ]); + priceEmbed.addFields({ + name: name, + value: price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + }); } } diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index d2510cc..f4c76be 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -27,7 +27,7 @@ export default class SuicideCommand extends BushCommand { iconURL: 'https://media.discordapp.net/attachments/770256340639416320/854689949193076737/Medical_31-60_974.jpg?width=523&height=523' }) - .addFields([ + .addFields( { name: '**National Suicide Prevention Hotline (U.S.):**', value: stripIndent` @@ -43,7 +43,7 @@ export default class SuicideCommand extends BushCommand { For Substance Abuse Support, Eating Disorder Support & Child Abuse and Domestic Violence: [Click to go to Discord's Health & Safety Page](https://discord.com/safety/360044103771-Mental-health-on-Discord#h_01EGRGT08QSZ5BNCH2E9HN0NYV)` } - ]); + ); return message.util.send({ embeds: [suicideEmbed], diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index baf764f..3cd0653 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -57,12 +57,10 @@ export default class WolframAlphaCommand extends BushCommand { args.image && void message.util.reply({ content: `${emojis.loading} Loading...`, embeds: [] }); const waApi = WolframAlphaAPI(this.client.config.credentials.wolframAlphaAppId); - const decodedEmbed = new EmbedBuilder().addFields([ - { - name: '📥 Input', - value: await this.client.utils.inspectCleanRedactCodeblock(args.expression) - } - ]); + const decodedEmbed = new EmbedBuilder().addFields({ + name: '📥 Input', + value: await this.client.utils.inspectCleanRedactCodeblock(args.expression) + }); const sendOptions: MessageOptions = { content: null, allowedMentions: AllowedMentions.none() }; try { const calculated = await (args.image @@ -72,22 +70,21 @@ export default class WolframAlphaCommand extends BushCommand { if (args.image) { decodedEmbed.setImage(await this.client.utils.uploadImageToImgur(calculated.split(',')[1])); - decodedEmbed.addFields([{ name: '📤 Output', value: '​' }]); + decodedEmbed.addFields({ name: '📤 Output', value: '​' }); } else { - decodedEmbed.addFields([ - { name: '📤 Output', value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString()) } - ]); + decodedEmbed.addFields({ + name: '📤 Output', + value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString()) + }); } } catch (error) { decodedEmbed .setTitle(`${emojis.errorFull} Unable to Query Expression`) .setColor(colors.error) - .addFields([ - { - name: `📤 Error`, - value: await this.client.utils.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') - } - ]); + .addFields({ + name: `📤 Error`, + value: await this.client.utils.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') + }); } sendOptions.embeds = [decodedEmbed]; |