diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-24 18:29:57 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-24 18:29:57 -0400 |
commit | 9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c (patch) | |
tree | 4b95a06ff6991207ab8b8e93f0bca26e24a97f80 /src/commands | |
parent | 6b8115ab1ec94d4330019fc7a93e094d9d64c48e (diff) | |
download | tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.gz tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.bz2 tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.zip |
fix: breaking changes
Diffstat (limited to 'src/commands')
25 files changed, 249 insertions, 206 deletions
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index a701998..cc5e7b4 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -43,7 +43,7 @@ export default class RoleAllCommand extends BushCommand { return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`); if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); - if (args.role.comparePositionTo(message.guild.me!.roles.highest) >= 0 && !args.role) { + if (args.role.comparePositionTo(message.guild.members.me!.roles.highest) >= 0 && !args.role) { return await message.util.reply(`${util.emojis.error} I cannot assign a role higher or equal to my highest role.`); } diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index c1dd142..e203d12 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -316,10 +316,10 @@ 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) => + settingsArr.map((s) => new UnsafeSelectMenuOptionBuilder() .setLabel(guildSettingsObj[s].name) .setValue(s) @@ -330,7 +330,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); @@ -363,9 +363,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}` ); @@ -375,10 +375,12 @@ 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 5218bcf..2eee0fe 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -84,7 +84,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, @@ -98,6 +98,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 a32aa8e..0f53198 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -260,8 +260,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, @@ -276,10 +276,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 046d9ab..d25b790 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -67,12 +67,16 @@ export default class JavascriptCommand extends BushCommand { }); embed.setTitle(`${util.emojis.successFull} Successfully Evaluated Expression`).setColor(util.colors.success); - embed.addFields({ name: '📥 Input', value: input }); - embed.addFields({ name: '📤 Output', value: output }); + embed.addFields([ + { name: '📥 Input', value: input }, + { name: '📤 Output', value: output } + ]); } catch (e) { embed.setTitle(`${util.emojis.errorFull} Unable to Evaluate Expression`).setColor(util.colors.error); - embed.addFields({ name: '📥 Input', value: input }); - embed.addFields({ name: '📤 Error', value: await util.inspectCleanRedactCodeblock(e, 'js') }); + embed.addFields([ + { name: '📥 Input', value: input }, + { name: '📤 Error', value: await util.inspectCleanRedactCodeblock(e, 'js') } + ]); } 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 f3fe86b..be6a015 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -50,8 +50,10 @@ export default class ShCommand extends BushCommand { .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() .setTitle('Shell Command') - .addFields({ name: '📥 Input', value: await util.codeblock(input, 1024, 'sh', true) }) - .addFields({ name: 'Running', value: util.emojis.loading }); + .addFields([ + { name: '📥 Input', value: await util.codeblock(input, 1024, 'sh', true) }, + { name: 'Running', value: util.emojis.loading } + ]); await message.util.reply({ embeds: [embed] }); @@ -72,15 +74,15 @@ export default class ShCommand extends BushCommand { .setColor(util.colors.success) .spliceFields(1, 1); - if (stdout) embed.addFields({ name: '📤 stdout', value: await util.codeblock(stdout, 1024, 'json', true) }); - if (stderr) embed.addFields({ name: '📤 stderr', value: await util.codeblock(stderr, 1024, 'json', true) }); + if (stdout) embed.addFields([{ name: '📤 stdout', value: await util.codeblock(stdout, 1024, 'json', true) }]); + if (stderr) embed.addFields([{ name: '📤 stderr', value: await util.codeblock(stderr, 1024, 'json', true) }]); } catch (e) { embed .setTitle(`${util.emojis.errorFull} An error occurred while executing.`) .setColor(util.colors.error) .spliceFields(1, 1); - embed.addFields({ name: '📤 Output', value: await util.codeblock(e?.stack, 1024, 'js', true) }); + embed.addFields([{ name: '📤 Output', value: await util.codeblock(e?.stack, 1024, 'js', true) }]); } await message.util.edit({ embeds: [embed] }); } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index deca6f1..9365107 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -52,17 +52,17 @@ export default class TestCommand extends BushCommand { } 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 ?? util.colors.default) .setDescription('Description') @@ -75,9 +75,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>[] = []; @@ -86,7 +86,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); } @@ -118,7 +118,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); } @@ -149,9 +149,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 1ea54f3..3338824 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -41,34 +41,36 @@ 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({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }) - .addFields({ - name: '**Memory Usage**', - value: `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { - binary: true - })}\nHeap: ${prettyBytes(process.memoryUsage().heapUsed, { binary: true })}/${prettyBytes( - process.memoryUsage().heapTotal, - { binary: true } - )}`, - inline: true - }) - .addFields({ name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true }) - .addFields({ name: '**Platform**', value: Platform[process.platform], inline: true }) - .addFields({ name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true }) - .addFields({ name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true }) - .addFields({ name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true }) - .addFields({ name: '**Discord.js Version**', value: discordJSVersion, inline: true }) - .addFields({ name: '**Node.js Version**', value: process.version.slice(1), inline: true }) - .addFields({ name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true }) - .addFields({ - name: '**Current Commit**', - value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, - inline: true - }) - .addFields({ name: '**Developers**', value: developers, inline: true }) + .addFields([ + { name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }, + { + name: '**Memory Usage**', + value: `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { + binary: true + })}\nHeap: ${prettyBytes(process.memoryUsage().heapUsed, { binary: true })}/${prettyBytes( + process.memoryUsage().heapTotal, + { binary: true } + )}`, + inline: true + }, + { name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true }, + { name: '**Platform**', value: Platform[process.platform], inline: true }, + { name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true }, + { name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true }, + { name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true }, + { name: '**Discord.js Version**', value: discordJSVersion, inline: true }, + { name: '**Node.js Version**', value: process.version.slice(1), inline: true }, + { name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true }, + { name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true }, + { name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true }, + { name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true }, + { + name: '**Current Commit**', + value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, + inline: true + }, + { name: '**Developers**', value: developers, inline: true } + ]) .setTimestamp() .setColor(util.colors.default); await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index cc4fcc3..a74c3f3 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -76,10 +76,12 @@ export default class ColorCommand extends BushCommand { } const embed = new EmbedBuilder() - .addFields({ name: '» Hexadecimal', value: color.toHexString() }) - .addFields({ name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` }) - .addFields({ name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }) - .addFields({ name: '» RGB', value: this.removePrefixAndParenthesis(color.toRgbString()) }) + .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 4049250..59a1001 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -135,7 +135,7 @@ export default class GuildInfoCommand extends BushCommand { ); if (guild.premiumSubscriptionCount) guildAbout.push(`**Boosts:** Level ${guild.premiumTier} with ${guild.premiumSubscriptionCount ?? 0} boosts`); - if (guild.me?.permissions.has(PermissionFlagsBits.ManageGuild) && guild.vanityURLCode) { + if (guild.members.me?.permissions.has(PermissionFlagsBits.ManageGuild) && guild.vanityURLCode) { const vanityInfo: Vanity = await guild.fetchVanityData(); guildAbout.push(`**Vanity URL:** discord.gg/${vanityInfo.code}`, `**Vanity Uses:** ${vanityInfo.uses?.toLocaleString()}`); } @@ -155,7 +155,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) { @@ -191,7 +191,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) { @@ -206,7 +206,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 93979ac..7a30e64 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -87,7 +87,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 await message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined }); @@ -98,18 +98,22 @@ export default class HelpCommand extends BushCommand { .setTitle(`${command.id} Command`) .setDescription(`${command.description ?? '*This command does not have a description.*'}`); 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') + } + ]); } 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') + } + ]); } - if (command.aliases?.length > 1) embed.addFields({ name: '» Aliases', value: `\`${command.aliases.join('` `')}\`` }); + if (command.aliases?.length > 1) embed.addFields([{ name: '» Aliases', value: `\`${command.aliases.join('` `')}\`` }]); if ( command.ownerOnly || command.superUserOnly || @@ -132,7 +136,7 @@ export default class HelpCommand extends BushCommand { .map((g) => util.format.inlineCode(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') }]); } const params = { embeds: [embed], components: row.components.length ? [row] : undefined }; @@ -143,15 +147,15 @@ export default class HelpCommand extends BushCommand { const row = new ActionRowBuilder<ButtonBuilder>(); if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { - row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); + row.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })]); } if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) { - row.addComponents( + row.addComponents([ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: 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 1cb6de0..91b62ca 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: BushMessage | BushSlashMessage) { const buttonRow = new ActionRowBuilder<ButtonBuilder>(); if (!client.config.isDevelopment || message.author.isOwner()) { - buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); + buttonRow.addComponents([new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })]); } - buttonRow.addComponents( + buttonRow.addComponents([ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: 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 04ceedd..086a77a 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -22,8 +22,10 @@ export default class PingCommand extends BushCommand { const apiLatency = `${'```'}\n ${Math.round(message.client.ws.ping)}ms ${'```'}`; const embed = new EmbedBuilder() .setTitle('Pong! 🏓') - .addFields({ name: 'Bot Latency', value: botLatency, inline: true }) - .addFields({ name: 'API Latency', value: apiLatency, inline: true }) + .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(util.colors.default) .setTimestamp(); @@ -41,12 +43,11 @@ export default class PingCommand extends BushCommand { const apiLatency = `${'```'}\n ${Math.round(client.ws.ping)}ms ${'```'}`; const embed = new EmbedBuilder() .setTitle('Pong! 🏓') - .addFields({ name: 'Bot Latency', value: botLatency, inline: true }) - .addFields({ name: 'API Latency', value: apiLatency, inline: true }) - .setFooter({ - text: message.interaction.user.username, - iconURL: message.interaction.user.displayAvatarURL() - }) + .addFields([ + { name: 'Bot Latency', value: botLatency, inline: true }, + { name: 'API Latency', value: apiLatency, inline: true } + ]) + .setFooter({ text: message.interaction.user.username, iconURL: message.interaction.user.displayAvatarURL() }) .setColor(util.colors.default) .setTimestamp(); await message.interaction.editReply({ diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index 71ae80d..933b1ac 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -1,6 +1,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import { ApplicationCommandOptionType, + ChannelType, EmbedBuilder, PermissionFlagsBits, SnowflakeUtil, @@ -42,7 +43,7 @@ export default class SnowflakeCommand extends BushCommand { // Channel if (client.channels.cache.has(snowflake)) { const channel = client.channels.resolve(snowflake)!; - const channelInfo = [`**Type:** ${BushChannelType[channel.type]}`]; + const channelInfo = [`**Type:** ${BushChannelType[channel.type] ?? ChannelType[channel.type]}`]; if (channel.isDM()) { channelInfo.push( `**Recipient:** ${util.discord.escapeMarkdown(channel.recipient?.tag ?? '¯\\_(ツ)_/¯')} (${ @@ -66,7 +67,7 @@ export default class SnowflakeCommand extends BushCommand { ); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(channel.name)} \`[Channel]\``); } - snowflakeEmbed.addFields({ name: '» Channel Info', value: channelInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Channel Info', value: channelInfo.join('\n') }]); } // Guild @@ -80,7 +81,7 @@ export default class SnowflakeCommand extends BushCommand { `**Members:** ${guild.memberCount?.toLocaleString()}` ]; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!); - snowflakeEmbed.addFields({ name: '» Server Info', value: guildInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Server Info', value: guildInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(guild.name)} \`[Server]\``); } @@ -90,7 +91,7 @@ export default class SnowflakeCommand extends BushCommand { const user: User = (client.users.cache.get(snowflake) ?? fetchedUser)!; const userInfo = [`**Name:** <@${user.id}> (${util.discord.escapeMarkdown(user.tag)})`]; if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048 })!); - snowflakeEmbed.addFields({ name: '» User Info', value: userInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» User Info', value: userInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(user.tag)} \`[User]\``); } @@ -102,7 +103,7 @@ export default class SnowflakeCommand extends BushCommand { `**Animated:** ${emoji.animated}` ]; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); - snowflakeEmbed.addFields({ name: '» Emoji Info', value: emojiInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Emoji Info', value: emojiInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} \`[Emoji]\``); } @@ -118,7 +119,7 @@ export default class SnowflakeCommand extends BushCommand { `**Hex Color:** ${role.hexColor}` ]; if (role.color) snowflakeEmbed.setColor(role.color); - snowflakeEmbed.addFields({ name: '» Role Info', value: roleInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Role Info', value: roleInfo.join('\n') }]); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(role.name)} \`[Role]\``); } @@ -131,7 +132,7 @@ export default class SnowflakeCommand extends BushCommand { `**Process ID:** ${deconstructedSnowflake.processId}`, `**Increment:** ${deconstructedSnowflake.increment}` ]; - snowflakeEmbed.addFields({ name: '» Snowflake Info', value: snowflakeInfo.join('\n') }); + snowflakeEmbed.addFields([{ name: '» Snowflake Info', value: snowflakeInfo.join('\n') }]); return await message.util.reply({ embeds: [snowflakeEmbed] }); } diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 0d6c891..5f4a1bd 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -135,7 +135,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( @@ -164,7 +164,7 @@ export default class UserInfoCommand extends BushCommand { ) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${util.discord.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?: BushGuildMember | undefined, title = '» Presence') { @@ -192,7 +192,7 @@ export default class UserInfoCommand extends BushCommand { if (activitiesNames.length) presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`); if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${util.discord.escapeMarkdown(customStatus)}`); - embed.addFields({ name: title, value: presenceInfo.join('\n') }); + embed.addFields([{ name: title, value: presenceInfo.join('\n') }]); enum statusEmojis { online = '787550449435803658', @@ -217,10 +217,12 @@ 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( @@ -242,7 +244,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: BushUser, title = '» Bot Information') { @@ -280,6 +282,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/leveling/levelRoles.ts b/src/commands/leveling/levelRoles.ts index 5ae9981..893e602 100644 --- a/src/commands/leveling/levelRoles.ts +++ b/src/commands/leveling/levelRoles.ts @@ -69,7 +69,7 @@ export default class LevelRolesCommand extends BushCommand { content: `${util.emojis.error} <@${args.role.id}> is higher or equal to your highest role.`, allowedMentions: AllowedMentions.none() }); - else if (args.role.comparePositionTo(message.guild.me!.roles.highest) >= 0) + else if (args.role.comparePositionTo(message.guild.members.me!.roles.highest) >= 0) return await message.util.reply({ content: `${util.emojis.error} <@${args.role.id}> is higher or equal to my highest role.`, allowedMentions: AllowedMentions.none() diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 4d57fcd..f8f6371 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -71,32 +71,34 @@ export default class ReportCommand extends BushCommand { .setTitle('New Report') .setColor(util.colors.red) .setDescription(evidence) - .addFields({ - name: 'Reporter', - value: [ - `**Name:**${message.author.tag} <@${message.author.id}>`, - `**Joined:** $${util.timestampAndDelta(message.member!.joinedAt!)}`, - `**Created:** ${util.timestampAndDelta(message.author.createdAt)}`, - `**Sent From**: <#${message.channel.id}> [Jump to context](${message.url})` - ].join('\n'), - inline: true - }) - .addFields({ - name: 'Reported User', - value: [ - `**Name:**${member.user.tag} <@${member.user.id}>`, - `**Joined:** $${util.timestampAndDelta(member.joinedAt!)}`, - `**Created:** ${util.timestampAndDelta(member.user.createdAt)}` - ].join('\n'), - inline: true - }); + .addFields([ + { + name: 'Reporter', + value: [ + `**Name:**${message.author.tag} <@${message.author.id}>`, + `**Joined:** $${util.timestampAndDelta(message.member!.joinedAt!)}`, + `**Created:** ${util.timestampAndDelta(message.author.createdAt)}`, + `**Sent From**: <#${message.channel.id}> [Jump to context](${message.url})` + ].join('\n'), + inline: true + }, + { + name: 'Reported User', + value: [ + `**Name:**${member.user.tag} <@${member.user.id}>`, + `**Joined:** $${util.timestampAndDelta(member.joinedAt!)}`, + `**Created:** ${util.timestampAndDelta(member.user.createdAt)}` + ].join('\n'), + 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 ca0bba0..31f59d7 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -108,10 +108,11 @@ 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 5e9184a..c0df828 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(util.colors.success) ] }); @@ -46,11 +46,13 @@ 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(util.colors.error) ] }); diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index 1a9d352..e17ef76 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -31,21 +31,25 @@ export default class CalculatorCommand extends BushCommand { } public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) { - const decodedEmbed = new EmbedBuilder().addFields({ - name: '📥 Input', - value: await util.inspectCleanRedactCodeblock(args.expression, 'mma') - }); + const decodedEmbed = new EmbedBuilder().addFields([ + { + name: '📥 Input', + value: await util.inspectCleanRedactCodeblock(args.expression, 'mma') + } + ]); try { const calculated = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(args.expression) ? '21' : evaluate(args.expression); decodedEmbed .setTitle(`${util.emojis.successFull} Successfully Calculated Expression`) .setColor(util.colors.success) - .addFields({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma') }); + .addFields([{ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma') }]); } catch (error) { decodedEmbed .setTitle(`${util.emojis.errorFull} Unable to Calculate Expression`) .setColor(util.colors.error) - .addFields({ name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }); + .addFields([ + { name: `📤 Error`, value: await util.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 978c1c6..729cf35 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -55,17 +55,19 @@ export default class DecodeCommand extends BushCommand { const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias ?? 'decoded'); const decodedEmbed = new EmbedBuilder() .setTitle(`${encodeOrDecode} Information`) - .addFields({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(data) }); + .addFields([{ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(data) }]); try { const decoded = Buffer.from(data, from).toString(to); decodedEmbed .setColor(util.colors.success) - .addFields({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(decoded) }); + .addFields([{ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(decoded) }]); } catch (error) { - decodedEmbed.setColor(util.colors.error).addFields({ - name: `📤 Error ${encodeOrDecode.slice(1)}ing`, - value: await util.inspectCleanRedactCodeblock(error?.stack ?? error) - }); + decodedEmbed.setColor(util.colors.error).addFields([ + { + name: `📤 Error ${encodeOrDecode.slice(1)}ing`, + value: await util.inspectCleanRedactCodeblock(error?.stack ?? 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 962d421..37ed6f6 100644 --- a/src/commands/utilities/highlight-show.ts +++ b/src/commands/utilities/highlight-show.ts @@ -41,23 +41,27 @@ export default class HighlightShowCommand extends BushCommand { .setColor(util.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], diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 0117715..e4e4f50 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -86,18 +86,18 @@ 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 ${util.format.input(parsedItem)}`) - .addFields({ name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) }) - .addFields({ name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) }) - .addFields({ + priceEmbed.setTitle(`Bazaar Information for ${util.format.input(parsedItem)}`).addFields([ + { name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) }, + { name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) }, + { name: 'Margin', value: ( Number(addBazaarInformation('buyPrice', 2, false)) - Number(addBazaarInformation('sellPrice', 2, false)) ).toLocaleString() - }) - .addFields({ name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) }) - .addFields({ name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) }); + }, + { 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] }); } @@ -140,10 +140,12 @@ 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 136de78..2cc16f0 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -26,23 +26,25 @@ export default class SuicideCommand extends BushCommand { iconURL: 'https://media.discordapp.net/attachments/770256340639416320/854689949193076737/Medical_31-60_974.jpg?width=523&height=523' }) - .addFields({ - name: '**National Suicide Prevention Hotline (U.S.):**', - value: [ - '**Call:** 1-800-273-8255, available 24/7 for emotional support', - '**Text: HOME** to 741741', - 'https://suicidepreventionlifeline.org/chat/', - '', - '**Outside the U.S:** Find a supportive resource on [this Wikipedia list of worldwide crisis hotlines](https://en.wikipedia.org/wiki/List_of_suicide_crisis_lines)' - ].join('\n') - }) - .addFields({ - name: '**More Support**', - value: [ - '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)" - ].join('\n') - }); + .addFields([ + { + name: '**National Suicide Prevention Hotline (U.S.):**', + value: [ + '**Call:** 1-800-273-8255, available 24/7 for emotional support', + '**Text: HOME** to 741741', + 'https://suicidepreventionlifeline.org/chat/', + '', + '**Outside the U.S:** Find a supportive resource on [this Wikipedia list of worldwide crisis hotlines](https://en.wikipedia.org/wiki/List_of_suicide_crisis_lines)' + ].join('\n') + }, + { + name: '**More Support**', + value: [ + '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)" + ].join('\n') + } + ]); return message.util.send({ embeds: [suicideEmbed], diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 95df5e8..0e1cb14 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -45,10 +45,12 @@ export default class WolframAlphaCommand extends BushCommand { args.image && void message.util.reply({ content: `${util.emojis.loading} Loading...`, embeds: [] }); const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId); - const decodedEmbed = new EmbedBuilder().addFields({ - name: '📥 Input', - value: await util.inspectCleanRedactCodeblock(args.expression) - }); + const decodedEmbed = new EmbedBuilder().addFields([ + { + name: '📥 Input', + value: await util.inspectCleanRedactCodeblock(args.expression) + } + ]); const sendOptions: MessageOptions = { content: null, allowedMentions: AllowedMentions.none() }; try { const calculated = await (args.image @@ -58,15 +60,17 @@ export default class WolframAlphaCommand extends BushCommand { if (args.image) { decodedEmbed.setImage(await util.uploadImageToImgur(calculated.split(',')[1])); - decodedEmbed.addFields({ name: '📤 Output', value: '' }); + decodedEmbed.addFields([{ name: '📤 Output', value: '' }]); } else { - decodedEmbed.addFields({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString()) }); + decodedEmbed.addFields([{ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString()) }]); } } catch (error) { decodedEmbed .setTitle(`${util.emojis.errorFull} Unable to Query Expression`) .setColor(util.colors.error) - .addFields({ name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }); + .addFields([ + { name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') } + ]); } sendOptions.embeds = [decodedEmbed]; |