diff options
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/config/config.ts | 18 | ||||
-rw-r--r-- | src/commands/config/features.ts | 4 | ||||
-rw-r--r-- | src/commands/dev/eval.ts | 10 | ||||
-rw-r--r-- | src/commands/dev/javascript.ts | 9 | ||||
-rw-r--r-- | src/commands/dev/sh.ts | 12 | ||||
-rw-r--r-- | src/commands/dev/test.ts | 18 | ||||
-rw-r--r-- | src/commands/info/botInfo.ts | 4 | ||||
-rw-r--r-- | src/commands/info/color.ts | 4 | ||||
-rw-r--r-- | src/commands/info/guildInfo.ts | 6 | ||||
-rw-r--r-- | src/commands/info/help.ts | 70 | ||||
-rw-r--r-- | src/commands/info/links.ts | 6 | ||||
-rw-r--r-- | src/commands/info/ping.ts | 4 | ||||
-rw-r--r-- | src/commands/info/snowflake.ts | 12 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 20 | ||||
-rw-r--r-- | src/commands/moulberry-bush/report.ts | 6 | ||||
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 5 | ||||
-rw-r--r-- | src/commands/moulberry-bush/serverStatus.ts | 14 | ||||
-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 |
23 files changed, 156 insertions, 190 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 66e10b6..c562add 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -320,7 +320,7 @@ export default class ConfigCommand extends BushCommand { const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n'); settingsEmbed.setDescription(desc); - const selMenu = new ActionRowBuilder<SelectMenuBuilder>().addComponents([ + const selMenu = new ActionRowBuilder<SelectMenuBuilder>().addComponents( new SelectMenuBuilder() .addOptions( settingsArr.map((s) => @@ -334,7 +334,7 @@ export default class ConfigCommand extends BushCommand { .setMaxValues(1) .setMinValues(1) .setCustomId('command_settingsSel') - ]); + ); return { embeds: [settingsEmbed], components: [selMenu] }; } else { settingsEmbed.setTitle(guildSettingsObj[setting].name); @@ -367,9 +367,9 @@ export default class ConfigCommand extends BushCommand { : '[No Value Set]'; }; - const components = new ActionRowBuilder<ButtonBuilder>().addComponents([ + const components = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' }) - ]); + ); settingsEmbed.setDescription( `${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type:** ${guildSettingsObj[setting].type}` ); @@ -379,12 +379,10 @@ export default class ConfigCommand extends BushCommand { message.util.isSlash ? snakeCase(setting) : setting } ${guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'} <value>" to set this setting.` }); - settingsEmbed.addFields([ - { - name: 'value', - value: (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]' - } - ]); + settingsEmbed.addFields({ + name: 'value', + value: (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]' + }); return { embeds: [settingsEmbed], components: [components] }; } } diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index e119936..5eafb0c 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -86,7 +86,7 @@ export default class FeaturesCommand extends BushCommand { } public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) { - return new ActionRowBuilder<SelectMenuBuilder>().addComponents([ + return new ActionRowBuilder<SelectMenuBuilder>().addComponents( new SelectMenuBuilder({ customId: 'command_selectFeature', disabled: disable, @@ -100,6 +100,6 @@ export default class FeaturesCommand extends BushCommand { description: guildFeaturesObj[f].description })) }) - ]); + ); } } diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 2be2963..ab7787d 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -262,8 +262,8 @@ export default class EvalCommand extends BushCommand { embed.setTimestamp(); - if (inputTS) embed.addFields([{ name: ':inbox_tray: Input (typescript)', value: inputTS }]); - embed.addFields([{ name: `:inbox_tray: Input${inputTS ? ' (transpiled javascript)' : ''}`, value: inputJS }]); + if (inputTS) embed.addFields({ name: ':inbox_tray: Input (typescript)', value: inputTS }); + embed.addFields({ name: `:inbox_tray: Input${inputTS ? ' (transpiled javascript)' : ''}`, value: inputJS }); const output = await this.codeblock(rawResult, 'js', { depth: selDepth ?? 0, @@ -279,10 +279,10 @@ export default class EvalCommand extends BushCommand { embed .setTitle(`${emojis[err ? 'errorFull' : 'successFull']} ${err ? 'Uns' : 'S'}uccessfully Evaluated Expression`) .setColor(colors[err ? 'error' : 'success']) - .addFields([{ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }]); + .addFields({ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }); - if (!err && methods) embed.addFields([{ name: ':wrench: Methods', value: methods }]); - if (!err && proto) embed.addFields([{ name: ':gear: Proto', value: proto }]); + if (!err && methods) embed.addFields({ name: ':wrench: Methods', value: methods }); + if (!err && proto) embed.addFields({ name: ':gear: Proto', value: proto }); if (!silent || message.util.isSlashMessage(message)) { await message.util.reply({ content: null, embeds: [embed] }); diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index e472a5a..6b6c7e1 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -73,16 +73,13 @@ export default class JavascriptCommand extends BushCommand { }); embed.setTitle(`${emojis.successFull} Successfully Evaluated Expression`).setColor(colors.success); - embed.addFields([ - { name: '📥 Input', value: input }, - { name: '📤 Output', value: output } - ]); + embed.addFields({ name: '📥 Input', value: input }, { name: '📤 Output', value: output }); } catch (e) { embed.setTitle(`${emojis.errorFull} Unable to Evaluate Expression`).setColor(colors.error); - embed.addFields([ + embed.addFields( { name: '📥 Input', value: input }, { name: '📤 Error', value: await this.client.utils.inspectCleanRedactCodeblock(e, 'js', { colors: false }) } - ]); + ); } embed.setTimestamp().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined }); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 7ffdf27..1b9ce22 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -59,10 +59,10 @@ export default class ShCommand extends BushCommand { .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() .setTitle('Shell Command') - .addFields([ + .addFields( { name: '📥 Input', value: await this.client.utils.codeblock(input, 1024, 'sh', true) }, { name: 'Running', value: emojis.loading } - ]); + ); await message.util.reply({ embeds: [embed] }); @@ -80,14 +80,12 @@ export default class ShCommand extends BushCommand { embed.setTitle(`${emojis.successFull} Executed command successfully.`).setColor(colors.success).spliceFields(1, 1); - if (stdout) embed.addFields([{ name: '📤 stdout', value: await this.client.utils.codeblock(stdout, 1024, 'ansi', true) }]); - if (stderr) embed.addFields([{ name: '📤 stderr', value: await this.client.utils.codeblock(stderr, 1024, 'ansi', true) }]); + if (stdout) embed.addFields({ name: '📤 stdout', value: await this.client.utils.codeblock(stdout, 1024, 'ansi', true) }); + if (stderr) embed.addFields({ name: '📤 stderr', value: await this.client.utils.codeblock(stderr, 1024, 'ansi', true) }); } catch (e) { embed.setTitle(`${emojis.errorFull} An error occurred while executing.`).setColor(colors.error).spliceFields(1, 1); - embed.addFields([ - { name: '📤 Output', value: await this.client.utils.codeblock(formatError(e, true), 1024, 'ansi', true) } - ]); + embed.addFields({ name: '📤 Output', value: await this.client.utils.codeblock(formatError(e, true), 1024, 'ansi', true) }); } await message.util.edit({ embeds: [embed] }); } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 600aeac..ac0ad83 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -62,17 +62,17 @@ export default class TestCommand extends BushCommand { if (args.feature) { if (['button', 'buttons'].includes(args.feature?.toLowerCase())) { - const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([ + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }), new ButtonBuilder({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }), new ButtonBuilder({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }), new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }), new ButtonBuilder({ style: ButtonStyle.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())) { const embed = new EmbedBuilder() - .addFields([{ name: 'Field Name', value: 'Field Content' }]) + .addFields({ name: 'Field Name', value: 'Field Content' }) .setAuthor({ name: 'Author', iconURL: 'https://www.w3schools.com/w3css/img_snowtops.jpg', url: 'https://google.com/' }) .setColor(message.member?.displayColor ?? colors.default) .setDescription('Description') @@ -85,9 +85,9 @@ export default class TestCommand extends BushCommand { ) .setTitle('Title'); - const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([ + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' }) - ]); + ); return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] }); } else if (['lots of buttons'].includes(args.feature?.toLowerCase())) { const buttonRows: ActionRowBuilder<ButtonBuilder>[] = []; @@ -96,7 +96,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new ButtonBuilder({ style: ButtonStyle.Primary, customId: id, label: id }); - row.addComponents([button]); + row.addComponents(button); } buttonRows.push(row); } @@ -128,7 +128,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new ButtonBuilder({ style: ButtonStyle.Secondary, customId: id, label: id }); - row.addComponents([button]); + row.addComponents(button); } ButtonRows.push(row); } @@ -159,9 +159,9 @@ export default class TestCommand extends BushCommand { const m = await message.util.reply({ content: 'Click for modal', components: [ - new ActionRowBuilder<ButtonBuilder>().addComponents([ + new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' }) - ]) + ) ] }); diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 25b860c..f284e0f 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -49,7 +49,7 @@ export default class BotInfoCommand extends BushCommand { if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4); const embed = new EmbedBuilder() .setTitle('Bot Info:') - .addFields([ + .addFields( { name: '**Uptime**', value: humanizeDuration(this.client.uptime!, 2), inline: true }, { name: '**Memory Usage**', @@ -79,7 +79,7 @@ export default class BotInfoCommand extends BushCommand { inline: true }, { name: '**Developers**', value: developers, inline: true } - ]) + ) .setTimestamp() .setColor(colors.default); await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 84c4b3c..7286c5c 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -63,12 +63,12 @@ export default class ColorCommand extends BushCommand { } const embed = new EmbedBuilder() - .addFields([ + .addFields( { name: '» Hexadecimal', value: color.toHexString() }, { name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` }, { name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }, { name: '» RGB', value: this.removePrefixAndParenthesis(color.toRgbString()) } - ]) + ) .setColor(parseInt(color.toHex(), 16)); return await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 060a439..dd5704f 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -168,7 +168,7 @@ export default class GuildInfoCommand extends BushCommand { ); } - embed.addFields([{ name: '» About', value: guildAbout.join('\n') }]); + embed.addFields({ name: '» About', value: guildAbout.join('\n') }); } private generateStatsField(embed: EmbedBuilder, guild: Guild | GuildPreview) { @@ -213,7 +213,7 @@ export default class GuildInfoCommand extends BushCommand { `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${StickerTierMap[guild.premiumTier]}` ); - embed.addFields([{ name: '» Stats', value: guildStats.join('\n') }]); + embed.addFields({ name: '» Stats', value: guildStats.join('\n') }); } private generateSecurityField(embed: EmbedBuilder, guild: Guild | GuildPreview) { @@ -228,7 +228,7 @@ export default class GuildInfoCommand extends BushCommand { `**2FA Required:** ${guild.mfaLevel === GuildMFALevel.Elevated ? 'True' : 'False'}` ); - embed.addFields([{ name: '» Security', value: guildSecurity.join('\n') }]); + embed.addFields({ name: '» Security', value: guildSecurity.join('\n') }); } } diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 1a19969..ec079e7 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -103,7 +103,7 @@ export default class HelpCommand extends BushCommand { .replace(/'(S)/g, (letter) => letter.toLowerCase()); const categoryCommands = categoryFilter.filter((cmd) => cmd.aliases.length > 0).map((cmd) => `\`${cmd.aliases[0]}\``); if (categoryCommands.length > 0) { - embed.addFields([{ name: `${categoryNice}`, value: `${categoryCommands.join(' ')}` }]); + embed.addFields({ name: `${categoryNice}`, value: `${categoryCommands.join(' ')}` }); } } return message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined }); @@ -129,34 +129,28 @@ export default class HelpCommand extends BushCommand { private addCommandUsage(embed: EmbedBuilder, command: BushCommand) { if (command.usage?.length) { - embed.addFields([ - { - name: `» Usage${command.usage.length > 1 ? 's' : ''}`, - value: command.usage.map((u) => `\`${u}\``).join('\n') - } - ]); + embed.addFields({ + name: `» Usage${command.usage.length > 1 ? 's' : ''}`, + value: command.usage.map((u) => `\`${u}\``).join('\n') + }); } } private addCommandExamples(embed: EmbedBuilder, command: BushCommand) { if (command.examples?.length) { - embed.addFields([ - { - name: `» Example${command.examples.length > 1 ? 's' : ''}`, - value: command.examples.map((u) => `\`${u}\``).join('\n') - } - ]); + embed.addFields({ + name: `» Example${command.examples.length > 1 ? 's' : ''}`, + value: command.examples.map((u) => `\`${u}\``).join('\n') + }); } } private addCommandAliases(embed: EmbedBuilder, command: BushCommand) { if (command.aliases?.length > 1) - embed.addFields([ - { - name: '» Aliases', - value: `\`${command.aliases.join('` `')}\`` - } - ]); + embed.addFields({ + name: '» Aliases', + value: `\`${command.aliases.join('` `')}\`` + }); } private addCommandArguments(embed: EmbedBuilder, command: BushCommand, isOwner = false, isSuperUser = false) { @@ -167,26 +161,24 @@ export default class HelpCommand extends BushCommand { return true; }); if (args.length) { - embed.addFields([ - { - name: '» Arguments', - value: args - .map((a) => { - let ret = stripIndent` + embed.addFields({ + name: '» Arguments', + value: args + .map((a) => { + let ret = stripIndent` \`${format(a.name, !!a.optional)}\` ⠀‣ **Desc**: ${a.description} ⠀‣ **Type**: ${typeof a.type !== 'function' ? a.type : '[no readable type]'}`; - if (a.flag?.length) ret += `\n⠀‣ **Flags**: ${a.flag.map((f) => `"${f}"`).join(', ')}`; - ret += `\n⠀‣ **Kind**: ${a.only ?? 'text & slash'}`; - if (a.only !== 'slash') ret += `\n⠀‣ **Match**: ${a.match}`; - if (a.only !== 'text') ret += `\n⠀‣ **Autocomplete**: ${a.autocomplete}`; + if (a.flag?.length) ret += `\n⠀‣ **Flags**: ${a.flag.map((f) => `"${f}"`).join(', ')}`; + ret += `\n⠀‣ **Kind**: ${a.only ?? 'text & slash'}`; + if (a.only !== 'slash') ret += `\n⠀‣ **Match**: ${a.match}`; + if (a.only !== 'text') ret += `\n⠀‣ **Autocomplete**: ${a.autocomplete}`; - return ret; - }) - .join('\n') - } - ]); + return ret; + }) + .join('\n') + }); } } @@ -213,7 +205,7 @@ export default class HelpCommand extends BushCommand { .map((g) => format.inlineCode(this.client.guilds.cache.find((g1) => g1.id === g)?.name ?? 'Unknown')) .join(' ')}` ); - if (restrictions.length) embed.addFields([{ name: '» Restrictions', value: restrictions.join('\n') }]); + if (restrictions.length) embed.addFields({ name: '» Restrictions', value: restrictions.join('\n') }); } } @@ -221,15 +213,15 @@ export default class HelpCommand extends BushCommand { const row = new ActionRowBuilder<ButtonBuilder>(); if (!this.client.config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { - row.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })]); + row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })); } if (!this.client.guilds.cache.get(this.client.config.supportGuild.id)?.members.cache.has(message.author.id)) { - row.addComponents([ + row.addComponents( new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite }) - ]); + ); } if (packageDotJSON?.repository) - row.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })]); + row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })); else void message.channel?.send('Error importing package.json, please report this to my developer.'); return row; diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index 23aa411..3671c6c 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -22,12 +22,12 @@ export default class LinksCommand extends BushCommand { public override async exec(message: CommandMessage | SlashMessage) { const buttonRow = new ActionRowBuilder<ButtonBuilder>(); if (!this.client.config.isDevelopment || message.author.isOwner()) { - buttonRow.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })]); + buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) })); } - buttonRow.addComponents([ + buttonRow.addComponents( new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite }), new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }) - ]); + ); return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] }); } } diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 060b1f6..484c010 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -34,10 +34,10 @@ export default class PingCommand extends BushCommand { const apiLatency = format.codeBlock(`${Math.round(message.client.ws.ping)}ms`); const embed = new EmbedBuilder() .setTitle('Pong! 🏓') - .addFields([ + .addFields( { name: 'Bot Latency', value: botLatency, inline: true }, { name: 'API Latency', value: apiLatency, inline: true } - ]) + ) .setFooter({ text: message.author.username, iconURL: message.author.displayAvatarURL() }) .setColor(colors.default) .setTimestamp(); diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index dba1378..f30330a 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -70,7 +70,7 @@ export default class SnowflakeCommand extends BushCommand { ); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(channel.name)} \`[Channel]\``); } - snowflakeEmbed.addFields([{ name: '» Channel Info', value: channelInfo.join('\n') }]); + snowflakeEmbed.addFields({ name: '» Channel Info', value: channelInfo.join('\n') }); } // Guild @@ -81,7 +81,7 @@ export default class SnowflakeCommand extends BushCommand { **Owner:** ${escapeMarkdown(this.client.users.cache.get(guild.ownerId)?.tag ?? '¯\\_(ツ)_/¯')} (${guild.ownerId}) **Members:** ${guild.memberCount?.toLocaleString()}`; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!); - snowflakeEmbed.addFields([{ name: '» Server Info', value: guildInfo }]); + snowflakeEmbed.addFields({ name: '» Server Info', value: guildInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(guild.name)} \`[Server]\``); } @@ -92,7 +92,7 @@ export default class SnowflakeCommand extends BushCommand { const userInfo = stripIndent` **Name:** <@${user.id}> (${escapeMarkdown(user.tag)})`; if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048 })!); - snowflakeEmbed.addFields([{ name: '» User Info', value: userInfo }]); + snowflakeEmbed.addFields({ name: '» User Info', value: userInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(user.tag)} \`[User]\``); } @@ -103,7 +103,7 @@ export default class SnowflakeCommand extends BushCommand { **Name:** ${escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} **Animated:** ${emoji.animated}`; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); - snowflakeEmbed.addFields([{ name: '» Emoji Info', value: emojiInfo }]); + snowflakeEmbed.addFields({ name: '» Emoji Info', value: emojiInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} \`[Emoji]\``); } @@ -118,7 +118,7 @@ export default class SnowflakeCommand extends BushCommand { **Position:** ${role.position} **Hex Color:** ${role.hexColor}`; if (role.color) snowflakeEmbed.setColor(role.color); - snowflakeEmbed.addFields([{ name: '» Role Info', value: roleInfo }]); + snowflakeEmbed.addFields({ name: '» Role Info', value: roleInfo }); snowflakeEmbed.setTitle(`:snowflake: ${escapeMarkdown(role.name)} \`[Role]\``); } @@ -130,7 +130,7 @@ export default class SnowflakeCommand extends BushCommand { **Worker ID:** ${deconstructedSnowflake.workerId} **Process ID:** ${deconstructedSnowflake.processId} **Increment:** ${deconstructedSnowflake.increment}`; - snowflakeEmbed.addFields([{ name: '» Snowflake Info', value: snowflakeInfo }]); + snowflakeEmbed.addFields({ name: '» Snowflake Info', value: snowflakeInfo }); return await message.util.reply({ embeds: [snowflakeEmbed] }); } diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 73a0422..3479ea3 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -145,7 +145,7 @@ export default class UserInfoCommand extends BushCommand { if (pronouns && typeof pronouns === 'string' && pronouns !== 'Unspecified') generalInfo.push(`**Pronouns:** ${pronouns}`); - embed.addFields([{ name: title, value: generalInfo.join('\n') }]); + embed.addFields({ name: title, value: generalInfo.join('\n') }); } public static generateServerInfoField(embed: EmbedBuilder, member?: GuildMember | undefined, title = '» Server Information') { @@ -170,7 +170,7 @@ export default class UserInfoCommand extends BushCommand { ) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${escapeMarkdown(member?.nickname)}`); - if (serverUserInfo.length) embed.addFields([{ name: title, value: serverUserInfo.join('\n') }]); + if (serverUserInfo.length) embed.addFields({ name: title, value: serverUserInfo.join('\n') }); } public static generatePresenceField(embed: EmbedBuilder, member?: GuildMember | undefined, title = '» Presence') { @@ -198,7 +198,7 @@ export default class UserInfoCommand extends BushCommand { if (activitiesNames.length) presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${oxford(activitiesNames, 'and', '')}`); if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${escapeMarkdown(customStatus)}`); - embed.addFields([{ name: title, value: presenceInfo.join('\n') }]); + embed.addFields({ name: title, value: presenceInfo.join('\n') }); enum statusEmojis { online = '787550449435803658', @@ -223,12 +223,10 @@ export default class UserInfoCommand extends BushCommand { .map((role) => `${role}`); const joined = roles.join(', '); - embed.addFields([ - { - name: `» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, - value: joined.length > 1024 ? 'Too Many Roles to Display' + '...' : joined - } - ]); + embed.addFields({ + name: `» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, + value: joined.length > 1024 ? 'Too Many Roles to Display' + '...' : joined + }); } public static generatePermissionsField( @@ -250,7 +248,7 @@ export default class UserInfoCommand extends BushCommand { }); } - if (perms.length) embed.addFields([{ name: title, value: perms.join(' ') }]); + if (perms.length) embed.addFields({ name: title, value: perms.join(' ') }); } public static async generateBotField(embed: EmbedBuilder, user: User, title = '» Bot Information') { @@ -290,6 +288,6 @@ export default class UserInfoCommand extends BushCommand { ); } - if (botInfo.length) embed.addFields([{ name: title, value: botInfo.join('\n') }]); + if (botInfo.length) embed.addFields({ name: title, value: botInfo.join('\n') }); } } diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 47e45f9..13ef2b6 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -79,7 +79,7 @@ export default class ReportCommand extends BushCommand { .setTitle('New Report') .setColor(colors.red) .setDescription(evidence) - .addFields([ + .addFields( { name: 'Reporter', value: stripIndent` @@ -97,14 +97,14 @@ export default class ReportCommand extends BushCommand { **Created:** ${timestampAndDelta(member.user.createdAt)}`, inline: true } - ]); + ); if (message.attachments.size > 0) { const fileName = message.attachments.first()!.name!.toLowerCase(); if (fileName.endsWith('.png') || fileName.endsWith('.jpg') || fileName.endsWith('.gif') || fileName.endsWith('.webp')) { reportEmbed.setImage(message.attachments.first()!.url); } else { - reportEmbed.addFields([{ name: 'Attachment', value: message.attachments.first()!.url }]); + reportEmbed.addFields({ name: 'Attachment', value: message.attachments.first()!.url }); } } await reportChannel.send({ embeds: [reportEmbed] }).then(async (ReportMessage) => { diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 574334a..d58b78e 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -123,11 +123,10 @@ export default class RuleCommand extends BushCommand { } if (rule) { if (rules[rule - 1]?.title && rules[rule - 1]?.description) - rulesEmbed.addFields([{ name: rules[rule - 1].title, value: rules[rule - 1].description }]); + rulesEmbed.addFields({ name: rules[rule - 1].title, value: rules[rule - 1].description }); } else { for (let i = 0; i < rules.length; i++) { - if (rules[i]?.title && rules[i]?.description) - rulesEmbed.addFields([{ name: rules[i].title, value: rules[i].description }]); + if (rules[i]?.title && rules[i]?.description) rulesEmbed.addFields({ name: rules[i].title, value: rules[i].description }); } } await message.util.send({ diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index c0c0518..a4d5e45 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -38,7 +38,7 @@ export default class ServerStatusCommand extends BushCommand { await message.util.edit({ embeds: [ msgEmbed - .addFields([{ name: 'Status', value: 'The server is online, all features related to prices will likely work.' }]) + .addFields({ name: 'Status', value: 'The server is online, all features related to prices will likely work.' }) .setColor(colors.success) ] }); @@ -46,13 +46,11 @@ export default class ServerStatusCommand extends BushCommand { await message.util.edit({ embeds: [ msgEmbed - .addFields([ - { - name: 'Status', - value: - "It appears Moulberry's server is offline, this means that everything related to prices will likely not work." - } - ]) + .addFields({ + name: 'Status', + value: + "It appears Moulberry's server is offline, this means that everything related to prices will likely not work." + }) .setColor(colors.error) ] }); 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]; |