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 | |
parent | 6b8115ab1ec94d4330019fc7a93e094d9d64c48e (diff) | |
download | tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.gz tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.bz2 tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.zip |
fix: breaking changes
Diffstat (limited to 'src')
67 files changed, 536 insertions, 435 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]; diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index 5534728..b08fc40 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -166,18 +166,18 @@ export class AutoMod { .setDescription( `**User:** ${this.message.author} (${this.message.author.tag})\n**Sent From:** <#${this.message.channel.id}> [Jump to context](${this.message.url})` ) - .addFields({ name: 'Message Content', value: `${await util.codeblock(this.message.content, 1024)}` }) + .addFields([{ name: 'Message Content', value: `${await util.codeblock(this.message.content, 1024)}` }]) .setColor(color) .setTimestamp() ], components: [ - new ActionRowBuilder<ButtonBuilder>().addComponents( + new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Danger, label: 'Ban User', customId: `automod;ban;${this.message.author.id};everyone mention and scam phrase` }) - ) + ]) ] }); } @@ -259,7 +259,7 @@ export class AutoMod { color = util.colors.yellow; void this.message.delete().catch((e) => deleteError.bind(this, e)); void this.message.member?.bushWarn({ - moderator: this.message.guild!.me!, + moderator: this.message.guild!.members.me!, reason: `[AutoMod] ${highestOffence.reason}` }); this.punished = true; @@ -269,7 +269,7 @@ export class AutoMod { color = util.colors.orange; void this.message.delete().catch((e) => deleteError.bind(this, e)); void this.message.member?.bushMute({ - moderator: this.message.guild!.me!, + moderator: this.message.guild!.members.me!, reason: `[AutoMod] ${highestOffence.reason}`, duration: 900_000 // 15 minutes }); @@ -280,7 +280,7 @@ export class AutoMod { color = util.colors.red; void this.message.delete().catch((e) => deleteError.bind(this, e)); void this.message.member?.bushMute({ - moderator: this.message.guild!.me!, + moderator: this.message.guild!.members.me!, reason: `[AutoMod] ${highestOffence.reason}`, duration: 0 // permanent }); @@ -331,7 +331,7 @@ export class AutoMod { this.message.channel.id }> [Jump to context](${this.message.url})\n**Blacklisted Words:** ${offences.map((o) => `\`${o.match}\``).join(', ')}` ) - .addFields({ name: 'Message Content', value: `${await util.codeblock(this.message.content, 1024)}` }) + .addFields([{ name: 'Message Content', value: `${await util.codeblock(this.message.content, 1024)}` }]) .setColor(color) .setTimestamp() .setAuthor({ name: this.message.author.tag, url: this.message.author.displayAvatarURL() }) @@ -339,13 +339,13 @@ export class AutoMod { components: highestOffence.severity >= 2 ? [ - new ActionRowBuilder<ButtonBuilder>().addComponents( + new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Danger, label: 'Ban User', customId: `automod;ban;${this.message.author.id};${highestOffence.reason}` }) - ) + ]) ] : undefined }); diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 59dcb68..cc95601 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -171,7 +171,7 @@ export class ButtonPaginator { * @returns The generated {@link ActionRow} */ protected getPaginationRow(disableAll = false) { - return new ActionRowBuilder<ButtonBuilder>().addComponents( + return new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate_beginning', @@ -202,7 +202,7 @@ export class ButtonPaginator { emoji: PaginateEmojis.END, disabled: disableAll || this.curPage === this.numPages - 1 }) - ); + ]); } /** diff --git a/src/lib/common/ConfirmationPrompt.ts b/src/lib/common/ConfirmationPrompt.ts index e86c236..c611fd3 100644 --- a/src/lib/common/ConfirmationPrompt.ts +++ b/src/lib/common/ConfirmationPrompt.ts @@ -29,10 +29,10 @@ export class ConfirmationPrompt { */ protected async send(): Promise<boolean> { this.messageOptions.components = [ - new ActionRowBuilder<ButtonBuilder>().addComponents( + new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Success, customId: 'confirmationPrompt_confirm', label: 'Yes' }), new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'confirmationPrompt_cancel', label: 'No' }) - ) + ]) ]; const msg = await this.message.channel!.send(this.messageOptions); diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts index 4874f78..03e2639 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -66,14 +66,14 @@ export class DeleteButton { */ protected updateComponents(edit = false, disable = false): void { this.messageOptions.components = [ - new ActionRowBuilder<ButtonBuilder>().addComponents( + new ActionRowBuilder<ButtonBuilder>().addComponents([ new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate__stop', emoji: PaginateEmojis.STOP, disabled: disable }) - ) + ]) ]; if (edit) { this.messageOptions.reply = undefined; diff --git a/src/lib/common/util/Moderation.ts b/src/lib/common/util/Moderation.ts index f388121..9f93375 100644 --- a/src/lib/common/util/Moderation.ts +++ b/src/lib/common/util/Moderation.ts @@ -91,7 +91,7 @@ export class Moderation { return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as you do.`; } if ( - victim.roles.highest.position >= victim.guild.me!.roles.highest.position && + victim.roles.highest.position >= victim.guild.members.me!.roles.highest.position && !(type.startsWith('un') && moderator.id === victim.id) ) { return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as I do.`; diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 563df3d..aea515a 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -823,7 +823,7 @@ export class BushClientUtil extends ClientUtil { * @returns The missing permissions or null if none are missing. */ public clientGuildPermCheck(message: BushMessage | BushSlashMessage, permissions: bigint[]): PermissionsString[] | null { - const missing = message.guild?.me?.permissions.missing(permissions) ?? []; + const missing = message.guild?.members.me?.permissions.missing(permissions) ?? []; return missing.length ? missing : null; } @@ -845,11 +845,11 @@ export class BushClientUtil extends ClientUtil { const sendPerm = message.channel!.isThread() ? 'SendMessages' : 'SendMessagesInThreads'; if (!message.inGuild()) return null; - if (!message.guild.me!.permissionsIn(message.channel.id).has(sendPerm)) missing.push(sendPerm); + if (!message.guild.members.me!.permissionsIn(message.channel.id).has(sendPerm)) missing.push(sendPerm); missing.push( ...(checkChannel - ? message.guild!.me!.permissionsIn(message.channel!.id!).missing(permissions) + ? message.guild!.members.me!.permissionsIn(message.channel!.id!).missing(permissions) : this.clientGuildPermCheck(message, permissions) ?? []) ); @@ -995,7 +995,7 @@ export class BushClientUtil extends ClientUtil { if (embed.author) embeds.at(0)?.setAuthor(embed.author); if (embed.title) embeds.at(0)?.setTitle(embed.title); if (embed.url) embeds.at(0)?.setURL(embed.url); - if (embed.fields) embeds.at(-1)?.setFields(...embed.fields); + if (embed.fields) embeds.at(-1)?.setFields(embed.fields); if (embed.thumbnail) embeds.at(-1)?.setThumbnail(embed.thumbnail.url); if (embed.footer) embeds.at(-1)?.setFooter(embed.footer); if (embed.image) embeds.at(-1)?.setImage(embed.image.url); diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index febe95a..958e451 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -46,7 +46,7 @@ import { type SlashResolveType } from 'discord-akairo'; import { - type ApplicationCommandOptionChoice, + type ApplicationCommandOptionChoiceData, type Collection, type Invite, type PermissionResolvable, @@ -147,7 +147,7 @@ interface BaseBushArgumentOptions extends Omit<ArgumentOptions, 'type' | 'prompt /** * The choices of the option for the user to pick from */ - choices?: ApplicationCommandOptionChoice[]; + choices?: ApplicationCommandOptionChoiceData[]; /** * Whether the option is an autocomplete option diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 8b1b5fa..80755bc 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -1,15 +1,15 @@ import { AllowedMentions, banResponse, + BushGuildChannelManager, + BushGuildMemberManager, BushMessage, dmResponse, permissionsResponse, punishmentEntryRemove, type BanResponse, type BushClient, - type BushGuildChannelManager, type BushGuildMember, - type BushGuildMemberManager, type BushGuildMemberResolvable, type BushNewsChannel, type BushTextChannel, @@ -151,7 +151,7 @@ export class BushGuild extends Guild { if (!logChannel || !logChannel.isTextBased()) return; if ( !logChannel - .permissionsFor(this.me!.id) + .permissionsFor(this.members.me!.id) ?.has([PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages, PermissionFlagsBits.EmbedLinks]) ) return; @@ -176,7 +176,7 @@ export class BushGuild extends Guild { */ public async bushBan(options: GuildBushBanOptions): Promise<BanResponse> { // checks - if (!this.me!.permissions.has(PermissionFlagsBits.BanMembers)) return banResponse.MISSING_PERMISSIONS; + if (!this.members.me!.permissions.has(PermissionFlagsBits.BanMembers)) return banResponse.MISSING_PERMISSIONS; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; @@ -319,7 +319,7 @@ export class BushGuild extends Guild { */ public async bushUnban(options: GuildBushUnbanOptions): Promise<UnbanResponse> { // checks - if (!this.me!.permissions.has(PermissionFlagsBits.BanMembers)) return unbanResponse.MISSING_PERMISSIONS; + if (!this.members.me!.permissions.has(PermissionFlagsBits.BanMembers)) return unbanResponse.MISSING_PERMISSIONS; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; @@ -413,7 +413,7 @@ export class BushGuild extends Guild { success.set(channel.id, false); continue; } - if (!channel.permissionsFor(this.me!.id)?.has([PermissionFlagsBits.ManageChannels])) { + if (!channel.permissionsFor(this.members.me!.id)?.has([PermissionFlagsBits.ManageChannels])) { errors.set(channel.id, new Error('client no permission')); success.set(channel.id, false); continue; @@ -442,7 +442,7 @@ export class BushGuild extends Guild { success.set(channel.id, false); } else { success.set(channel.id, true); - await permissionOverwrites.edit(this.me!, permsForMe, { reason }); + await permissionOverwrites.edit(this.members.me!, permsForMe, { reason }); await channel.send({ embeds: [ { @@ -466,8 +466,8 @@ export class BushGuild extends Guild { } public async quote(rawQuote: APIMessage, channel: BushTextChannel | BushNewsChannel | BushThreadChannel) { - if (!channel.isTextBased() || channel.isDMBased() || channel.guildId !== this.id || !this.me) return null; - if (!channel.permissionsFor(this.me).has('ManageWebhooks')) return null; + if (!channel.isTextBased() || channel.isDMBased() || channel.guildId !== this.id || !this.members.me) return null; + if (!channel.permissionsFor(this.members.me).has('ManageWebhooks')) return null; const quote = new BushMessage(client, rawQuote); @@ -643,10 +643,6 @@ export class BushGuild extends Guild { } } -export interface BushGuild extends Guild { - get me(): BushGuildMember | null; -} - /** * Options for unbanning a user */ diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index 5d7144b..5e9e150 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -65,7 +65,7 @@ export class BushGuildMember extends GuildMember { public async bushWarn(options: BushPunishmentOptions): Promise<{ result: WarnResponse; caseNum: number | null }> { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return { result: warnResponse.CANNOT_RESOLVE_USER, caseNum: null }; const ret = await (async (): Promise<{ result: WarnResponse; caseNum: number | null }> => { @@ -107,12 +107,12 @@ export class BushGuildMember extends GuildMember { */ public async bushAddRole(options: AddRoleOptions): Promise<AddRoleResponse> { // checks - if (!this.guild.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return addRoleResponse.MISSING_PERMISSIONS; + if (!this.guild.members.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return addRoleResponse.MISSING_PERMISSIONS; const ifShouldAddRole = this.#checkIfShouldAddRole(options.role, options.moderator); if (ifShouldAddRole !== true) return ifShouldAddRole; let caseID: string | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return addRoleResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -178,12 +178,12 @@ export class BushGuildMember extends GuildMember { */ public async bushRemoveRole(options: RemoveRoleOptions): Promise<RemoveRoleResponse> { // checks - if (!this.guild.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return removeRoleResponse.MISSING_PERMISSIONS; + if (!this.guild.members.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return removeRoleResponse.MISSING_PERMISSIONS; const ifShouldAddRole = this.#checkIfShouldAddRole(options.role, options.moderator); if (ifShouldAddRole !== true) return ifShouldAddRole; let caseID: string | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return removeRoleResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -255,7 +255,7 @@ export class BushGuildMember extends GuildMember { return shouldAddRoleResponse.USER_HIERARCHY; } else if (role.managed) { return shouldAddRoleResponse.ROLE_MANAGED; - } else if (this.guild.me!.roles.highest.position <= role.position) { + } else if (this.guild.members.me!.roles.highest.position <= role.position) { return shouldAddRoleResponse.CLIENT_HIERARCHY; } return true; @@ -269,17 +269,17 @@ export class BushGuildMember extends GuildMember { */ public async bushMute(options: BushTimedPunishmentOptions): Promise<MuteResponse> { // checks - if (!this.guild.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return muteResponse.MISSING_PERMISSIONS; + if (!this.guild.members.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return muteResponse.MISSING_PERMISSIONS; const muteRoleID = await this.guild.getSetting('muteRole'); if (!muteRoleID) return muteResponse.NO_MUTE_ROLE; const muteRole = this.guild.roles.cache.get(muteRoleID); if (!muteRole) return muteResponse.MUTE_ROLE_INVALID; - if (muteRole.position >= this.guild.me!.roles.highest.position || muteRole.managed) + if (muteRole.position >= this.guild.members.me!.roles.highest.position || muteRole.managed) return muteResponse.MUTE_ROLE_NOT_MANAGEABLE; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return muteResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -355,17 +355,17 @@ export class BushGuildMember extends GuildMember { */ public async bushUnmute(options: BushPunishmentOptions): Promise<UnmuteResponse> { // checks - if (!this.guild.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return unmuteResponse.MISSING_PERMISSIONS; + if (!this.guild.members.me!.permissions.has(PermissionFlagsBits.ManageRoles)) return unmuteResponse.MISSING_PERMISSIONS; const muteRoleID = await this.guild.getSetting('muteRole'); if (!muteRoleID) return unmuteResponse.NO_MUTE_ROLE; const muteRole = this.guild.roles.cache.get(muteRoleID); if (!muteRole) return unmuteResponse.MUTE_ROLE_INVALID; - if (muteRole.position >= this.guild.me!.roles.highest.position || muteRole.managed) + if (muteRole.position >= this.guild.members.me!.roles.highest.position || muteRole.managed) return unmuteResponse.MUTE_ROLE_NOT_MANAGEABLE; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return unmuteResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -438,12 +438,12 @@ export class BushGuildMember extends GuildMember { */ public async bushKick(options: BushPunishmentOptions): Promise<KickResponse> { // checks - if (!this.guild.me?.permissions.has(PermissionFlagsBits.KickMembers) || !this.kickable) + if (!this.guild.members.me?.permissions.has(PermissionFlagsBits.KickMembers) || !this.kickable) return kickResponse.MISSING_PERMISSIONS; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return kickResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { // add modlog entry @@ -492,17 +492,18 @@ export class BushGuildMember extends GuildMember { */ public async bushBan(options: BushBanOptions): Promise<Exclude<BanResponse, typeof banResponse['ALREADY_BANNED']>> { // checks - if (!this.guild.me!.permissions.has(PermissionFlagsBits.BanMembers) || !this.bannable) return banResponse.MISSING_PERMISSIONS; + if (!this.guild.members.me!.permissions.has(PermissionFlagsBits.BanMembers) || !this.bannable) + return banResponse.MISSING_PERMISSIONS; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return banResponse.CANNOT_RESOLVE_USER; // ignore result, they should still be banned even if their mute cannot be removed await this.bushUnmute({ reason: 'User is about to be banned, a mute is no longer necessary.', - moderator: this.guild.me!, + moderator: this.guild.members.me!, silent: true }); @@ -574,12 +575,12 @@ export class BushGuildMember extends GuildMember { if (!channel || (!channel.isTextBased() && !channel.isThread())) return blockResponse.INVALID_CHANNEL; // checks - if (!channel.permissionsFor(this.guild.me!)!.has(PermissionFlagsBits.ManageChannels)) + if (!channel.permissionsFor(this.guild.members.me!)!.has(PermissionFlagsBits.ManageChannels)) return blockResponse.MISSING_PERMISSIONS; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return blockResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -665,12 +666,12 @@ export class BushGuildMember extends GuildMember { const channel = _channel as BushGuildTextBasedChannel; // checks - if (!channel.permissionsFor(this.guild.me!)!.has(PermissionFlagsBits.ManageChannels)) + if (!channel.permissionsFor(this.guild.members.me!)!.has(PermissionFlagsBits.ManageChannels)) return unblockResponse.MISSING_PERMISSIONS; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return unblockResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -748,14 +749,14 @@ export class BushGuildMember extends GuildMember { */ public async bushTimeout(options: BushTimeoutOptions): Promise<TimeoutResponse> { // checks - if (!this.guild.me!.permissions.has(PermissionFlagsBits.ModerateMembers)) return timeoutResponse.MISSING_PERMISSIONS; + if (!this.guild.members.me!.permissions.has(PermissionFlagsBits.ModerateMembers)) return timeoutResponse.MISSING_PERMISSIONS; const twentyEightDays = Time.Day * 28; if (options.duration > twentyEightDays) return timeoutResponse.INVALID_DURATION; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return timeoutResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -812,11 +813,12 @@ export class BushGuildMember extends GuildMember { */ public async bushRemoveTimeout(options: BushPunishmentOptions): Promise<RemoveTimeoutResponse> { // checks - if (!this.guild.me!.permissions.has(PermissionFlagsBits.ModerateMembers)) return removeTimeoutResponse.MISSING_PERMISSIONS; + if (!this.guild.members.me!.permissions.has(PermissionFlagsBits.ModerateMembers)) + return removeTimeoutResponse.MISSING_PERMISSIONS; let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.me); + const moderator = await util.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return removeTimeoutResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.ts index 3f8dcd2..b0368b5 100644 --- a/src/lib/extensions/discord.js/BushGuildMemberManager.ts +++ b/src/lib/extensions/discord.js/BushGuildMemberManager.ts @@ -52,7 +52,7 @@ export declare class BushGuildMemberManager * @example * // Ban a user by id (or with a user/guild member object) * guild.members.ban('84484653687267328') - * .then(kickInfo => console.log(`Banned ${kickInfo.user?.tag ?? kickInfo.tag ?? kickInfo}`)) + * .then(banInfo => console.log(`Banned ${banInfo.user?.tag ?? banInfo.tag ?? banInfo}`)) * .catch(console.error); */ public ban(user: BushUserResolvable, options?: BanOptions): Promise<BushGuildMember | BushUser | Snowflake>; @@ -169,5 +169,9 @@ export declare class BushGuildMemberManager * .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`)) * .catch(console.error); */ - public unban(user: BushUserResolvable, reason?: string): Promise<BushUser>; + public unban(user: BushUserResolvable, reason?: string): Promise<BushUser | null>; +} + +export interface BushGuildMemberManager extends CachedManager<Snowflake, BushGuildMember, BushGuildMemberResolvable> { + get me(): BushGuildMember | null; } diff --git a/src/lib/extensions/discord.js/BushThreadManager.ts b/src/lib/extensions/discord.js/BushThreadManager.ts index b84b98d..0748a4d 100644 --- a/src/lib/extensions/discord.js/BushThreadManager.ts +++ b/src/lib/extensions/discord.js/BushThreadManager.ts @@ -1,10 +1,8 @@ -import type { BushThreadChannel } from '#lib'; +import type { BushFetchedThreads, BushThreadChannel } from '#lib'; import { CachedManager, - FetchedThreads, NewsChannel, TextChannel, - ThreadChannel, ThreadManager, type BaseFetchOptions, type FetchArchivedThreadOptions, @@ -54,7 +52,7 @@ export declare class BushThreadManager<AllowedThreadType> * .then(threadChannel => console.log(threadChannel)) * .catch(console.error); */ - public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>; + public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<BushThreadChannel>; /** * Obtains a thread from Discord, or the channel cache if it's already available. @@ -69,18 +67,18 @@ export declare class BushThreadManager<AllowedThreadType> * .catch(console.error); */ public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<BushThreadChannel | null>; - public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<FetchedThreads>; + public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<BushFetchedThreads>; /** * Obtains a set of archived threads from Discord, requires `READ_MESSAGE_HISTORY` in the parent channel. * @param options The options to fetch archived threads * @param cache Whether to cache the new thread objects if they aren't already */ - public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<FetchedThreads>; + public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<BushFetchedThreads>; /** * Obtains the accessible active threads from Discord, requires `READ_MESSAGE_HISTORY` in the parent channel. * @param cache Whether to cache the new thread objects if they aren't already */ - public fetchActive(cache?: boolean): Promise<FetchedThreads>; + public fetchActive(cache?: boolean): Promise<BushFetchedThreads>; } diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.ts index 48e968f..d183b30 100644 --- a/src/lib/extensions/discord.js/BushThreadMemberManager.ts +++ b/src/lib/extensions/discord.js/BushThreadMemberManager.ts @@ -47,6 +47,13 @@ export declare class BushThreadMemberManager public remove(id: Snowflake | '@me', reason?: string): Promise<Snowflake>; } +export interface BushThreadMemberManager extends CachedManager<Snowflake, BushThreadMember, BushThreadMemberResolvable> { + /** + * The client user as a ThreadMember of this ThreadChannel + */ + get me(): BushThreadMember | null; +} + export interface BushThreadMemberFetchOptions extends BaseFetchOptions { /** * The specific user to fetch from the thread diff --git a/src/lib/extensions/discord.js/other.ts b/src/lib/extensions/discord.js/other.ts index 086ace0..aeba01c 100644 --- a/src/lib/extensions/discord.js/other.ts +++ b/src/lib/extensions/discord.js/other.ts @@ -27,10 +27,12 @@ import type { Collection, EmojiIdentifierResolvable, EmojiResolvable, + FetchedThreads, GuildChannelResolvable, GuildMemberResolvable, GuildTextChannelResolvable, MessageResolvable, + PartialGroupDMChannel, RoleResolvable, Snowflake, ThreadChannelResolvable, @@ -105,6 +107,7 @@ export type BushAnyChannel = | BushCategoryChannel | BushDMChannel | PartialBushDMChannel + | PartialGroupDMChannel | BushNewsChannel | BushStageChannel | BushTextChannel @@ -114,7 +117,13 @@ export type BushAnyChannel = /** * The channels that are text-based. */ -export type BushTextBasedChannel = PartialBushDMChannel | BushThreadChannel | BushDMChannel | BushNewsChannel | BushTextChannel; +export type BushTextBasedChannel = + | BushDMChannel + | PartialBushDMChannel + | BushNewsChannel + | BushTextChannel + | BushThreadChannel + | BushVoiceChannel; /** * The types of channels that are text-based. @@ -125,6 +134,8 @@ export type BushVoiceBasedChannel = Extract<BushAnyChannel, { bitrate: number }> export type BushGuildBasedChannel = Extract<BushAnyChannel, { guild: BushGuild }>; +export type BushNonCategoryGuildBasedChannel = Exclude<BushGuildBasedChannel, BushCategoryChannel>; + export type BushNonThreadGuildBasedChannel = Exclude<BushGuildBasedChannel, BushThreadChannel>; export type BushGuildTextBasedChannel = Extract<BushGuildBasedChannel, BushTextBasedChannel>; @@ -154,7 +165,7 @@ export type BushMappedGuildChannelTypes = { /** * The data returned from a thread fetch that returns multiple threads. */ -export interface BushFetchedThreads { +export interface BushFetchedThreads extends FetchedThreads { /** * The threads that were fetched, with any members returned */ @@ -166,8 +177,6 @@ export interface BushFetchedThreads { hasMore?: boolean; } -export type BushNonCategoryGuildBasedChannel = Exclude<BushGuildBasedChannel, BushCategoryChannel>; - export type BushGuildCacheMessage<Cached extends CacheType> = CacheTypeReducer< Cached, BushMessage<true>, diff --git a/src/listeners/bush/appealListener.ts b/src/listeners/bush/appealListener.ts index b50b3c5..64979b5 100644 --- a/src/listeners/bush/appealListener.ts +++ b/src/listeners/bush/appealListener.ts @@ -36,10 +36,7 @@ export default class AppealListener extends BushListener { .setTitle( `${message.embeds[0].fields!.find((f) => f.name === 'What type of punishment are you appealing?')!.value} appeal` ) - .addFields({ - name: '» User Information', - value: 'Unable to fetch author, ID was likely invalid' - }) + .addFields([{ name: '» User Information', value: 'Unable to fetch author, ID was likely invalid' }]) ] }); @@ -70,12 +67,14 @@ export default class AppealListener extends BushListener { if (member.roles.cache.size > 1) UserInfoCommand.generateRolesField(embed, member); } - embed.addFields({ - name: '» Latest Modlogs', - value: latestModlogs.length - ? latestModlogs.map((ml) => ModlogCommand.generateModlogInfo(ml, false)).join(ModlogCommand.separator) - : 'No Modlogs Found' - }); + embed.addFields([ + { + name: '» Latest Modlogs', + value: latestModlogs.length + ? latestModlogs.map((ml) => ModlogCommand.generateModlogInfo(ml, false)).join(ModlogCommand.separator) + : 'No Modlogs Found' + } + ]); await thread.send({ embeds: [embed] }); } diff --git a/src/listeners/bush/joinAutoBan.ts b/src/listeners/bush/joinAutoBan.ts index c258877..0b38766 100644 --- a/src/listeners/bush/joinAutoBan.ts +++ b/src/listeners/bush/joinAutoBan.ts @@ -21,7 +21,7 @@ export default class JoinAutoBanListener extends BushListener { if (eval(code)) { const res = await member.bushBan({ reason: '[AutoBan] Impersonation is not allowed.', - moderator: member.guild.me! + moderator: member.guild.members.me! }); if (!['success', 'failed to dm'].includes(res)) { diff --git a/src/listeners/bush/supportThread.ts b/src/listeners/bush/supportThread.ts index 23c1e44..2eb8dc9 100644 --- a/src/listeners/bush/supportThread.ts +++ b/src/listeners/bush/supportThread.ts @@ -32,7 +32,7 @@ export default class SupportThreadListener extends BushListener { assert(message.channel instanceof BushTextChannel); - if (!message.channel.permissionsFor(message.guild.me!).has(PermissionFlagsBits.CreatePublicThreads)) return; + if (!message.channel.permissionsFor(message.guild.members.me!).has(PermissionFlagsBits.CreatePublicThreads)) return; const thread = await message .startThread({ name: `Support - ${message.author.username}#${message.author.discriminator}`, diff --git a/src/listeners/bush/userUpdateAutoBan.ts b/src/listeners/bush/userUpdateAutoBan.ts index e3fba02..68dfa38 100644 --- a/src/listeners/bush/userUpdateAutoBan.ts +++ b/src/listeners/bush/userUpdateAutoBan.ts @@ -27,7 +27,7 @@ export default class UserUpdateAutoBanListener extends BushListener { const res = await member.bushBan({ reason: '[AutoBan] Impersonation is not allowed.', - moderator: member.guild.me! + moderator: member.guild.members.me! }); if (!['success', 'failed to dm'].includes(res)) { diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 6a66375..e1acb00 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -149,7 +149,7 @@ export default class CommandErrorListener extends BushListener { description.push(...options.haste); - embed.addFields({ name: 'Stack Trace', value: options.stack.substring(0, 1024) }); + embed.addFields([{ name: 'Stack Trace', value: options.stack.substring(0, 1024) }]); if (description.length) embed.setDescription(description.join('\n').substring(0, 4000)); if (options.type === 'command-dev' || options.type === 'command-log') diff --git a/src/listeners/guild-custom/bushLockdown.ts b/src/listeners/guild-custom/bushLockdown.ts index 54e1ab1..85890cf 100644 --- a/src/listeners/guild-custom/bushLockdown.ts +++ b/src/listeners/guild-custom/bushLockdown.ts @@ -17,15 +17,17 @@ export default class BushLockdownListener extends BushListener { const logEmbed = new EmbedBuilder() .setColor(util.colors.Blurple) .setTimestamp() - .addFields({ name: '**Action**', value: `${'Lockdown'}` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) - .addFields({ - name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, - value: channelsSuccessMap - .map((success, channel) => `<#${channel}> ${success ? util.emojis.success : util.emojis.error}`) - .join('\n') - }); + .addFields([ + { name: '**Action**', value: `${'Lockdown'}` }, + { name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }, + { + name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, + value: channelsSuccessMap + .map((success, channel) => `<#${channel}> ${success ? util.emojis.success : util.emojis.error}`) + .join('\n') + } + ]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/guild-custom/bushUnlockdown.ts b/src/listeners/guild-custom/bushUnlockdown.ts index 4697c92..26217d8 100644 --- a/src/listeners/guild-custom/bushUnlockdown.ts +++ b/src/listeners/guild-custom/bushUnlockdown.ts @@ -17,15 +17,17 @@ export default class BushUnlockdownListener extends BushListener { const logEmbed = new EmbedBuilder() .setColor(util.colors.Blurple) .setTimestamp() - .addFields({ name: '**Action**', value: `${'Unlockdown'}` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) - .addFields({ - name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, - value: channelsSuccessMap - .map((success, channel) => `<#${channel}> ${success ? util.emojis.success : util.emojis.error}`) - .join('\n') - }); + .addFields([ + { name: '**Action**', value: `${'Unlockdown'}` }, + { name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }, + { + name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, + value: channelsSuccessMap + .map((success, channel) => `<#${channel}> ${success ? util.emojis.success : util.emojis.error}`) + .join('\n') + } + ]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index 27d5be2..94d35a5 100644 --- a/src/listeners/guild/guildMemberAdd.ts +++ b/src/listeners/guild/guildMemberAdd.ts @@ -22,9 +22,9 @@ export default class GuildMemberAddListener extends BushListener { if (!welcome) return; if (member.guild.id !== welcome?.guild.id) throw new Error('Welcome channel must be in the guild.'); - if (!welcome.guild.me) return; + if (!welcome.guild.members.me) return; - if (!welcome.permissionsFor(welcome.guild.me).has('SendMessages')) + if (!welcome.permissionsFor(welcome.guild.members.me).has('SendMessages')) // eslint-disable-next-line @typescript-eslint/no-base-to-string return welcome.guild.error('Send Welcome Message', `I do not have permission to send messages in ${welcome}.`); diff --git a/src/listeners/member-custom/bushBan.ts b/src/listeners/member-custom/bushBan.ts index efdabb9..1727433 100644 --- a/src/listeners/member-custom/bushBan.ts +++ b/src/listeners/member-custom/bushBan.ts @@ -20,12 +20,14 @@ export default class BushBanListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${duration ? 'Temp Ban' : 'Perm Ban'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (duration) logEmbed.addFields({ name: '**Duration**', value: util.humanizeDuration(duration) }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${duration ? 'Temp Ban' : 'Perm Ban'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (duration) logEmbed.addFields([{ name: '**Duration**', value: util.humanizeDuration(duration) }]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushBlock.ts b/src/listeners/member-custom/bushBlock.ts index 26de816..7cc33d2 100644 --- a/src/listeners/member-custom/bushBlock.ts +++ b/src/listeners/member-custom/bushBlock.ts @@ -22,14 +22,16 @@ export default class BushBlockListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${duration ? 'Temp Block' : 'Perm Block'}` }) - .addFields({ name: '**Channel**', value: `<#${channel.id}>` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + .addFields([ + { name: '**Action**', value: `${duration ? 'Temp Block' : 'Perm Block'}` }, + { name: '**Channel**', value: `<#${channel.id}>` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); - if (duration) logEmbed.addFields({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + if (duration) logEmbed.addFields([{ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushKick.ts b/src/listeners/member-custom/bushKick.ts index 5494db3..1be7bf9 100644 --- a/src/listeners/member-custom/bushKick.ts +++ b/src/listeners/member-custom/bushKick.ts @@ -20,11 +20,13 @@ export default class BushKickListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Kick'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${'Kick'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushMute.ts b/src/listeners/member-custom/bushMute.ts index df723eb..a0aa37d 100644 --- a/src/listeners/member-custom/bushMute.ts +++ b/src/listeners/member-custom/bushMute.ts @@ -20,12 +20,14 @@ export default class BushMuteListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${duration ? 'Temp Mute' : 'Perm Mute'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (duration) logEmbed.addFields({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${duration ? 'Temp Mute' : 'Perm Mute'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (duration) logEmbed.addFields([{ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushPunishRole.ts b/src/listeners/member-custom/bushPunishRole.ts index 716488e..5604bac 100644 --- a/src/listeners/member-custom/bushPunishRole.ts +++ b/src/listeners/member-custom/bushPunishRole.ts @@ -20,11 +20,13 @@ export default class BushPunishRoleListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (duration) logEmbed.addFields({ name: '**Duration**', value: util.humanizeDuration(duration) }); + .addFields([ + { name: '**Action**', value: `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (duration) logEmbed.addFields([{ name: '**Duration**', value: util.humanizeDuration(duration) }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushPunishRoleRemove.ts b/src/listeners/member-custom/bushPunishRoleRemove.ts index c5103e3..1a13de0 100644 --- a/src/listeners/member-custom/bushPunishRoleRemove.ts +++ b/src/listeners/member-custom/bushPunishRoleRemove.ts @@ -20,11 +20,13 @@ export default class BushPunishRoleRemoveListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Remove Punishment Role'}` }) - .addFields({ name: '**Role**', value: `${role}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + .addFields([ + { name: '**Action**', value: `${'Remove Punishment Role'}` }, + { name: '**Role**', value: `${role}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushPurge.ts b/src/listeners/member-custom/bushPurge.ts index 1c373fb..49d848f 100644 --- a/src/listeners/member-custom/bushPurge.ts +++ b/src/listeners/member-custom/bushPurge.ts @@ -28,15 +28,17 @@ export default class BushPurgeListener extends BushListener { .setTimestamp() .setFooter({ text: `${messages.size.toLocaleString()} Messages` }) .setAuthor({ name: moderator.tag, iconURL: moderator.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Purge'}` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Channel**', value: `<#${channel.id}> (${channel.name})` }) - .addFields({ - name: '**Messages**', - value: `${ - haste.url ? `[haste](${haste.url})${haste.error ? `- ${haste.error}` : ''}` : `${util.emojis.error} ${haste.error}` - }` - }); + .addFields([ + { name: '**Action**', value: `${'Purge'}` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Channel**', value: `<#${channel.id}> (${channel.name})` }, + { + name: '**Messages**', + value: `${ + haste.url ? `[haste](${haste.url})${haste.error ? `- ${haste.error}` : ''}` : `${util.emojis.error} ${haste.error}` + }` + } + ]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushRemoveTimeout.ts b/src/listeners/member-custom/bushRemoveTimeout.ts index bf2e402..aafa11e 100644 --- a/src/listeners/member-custom/bushRemoveTimeout.ts +++ b/src/listeners/member-custom/bushRemoveTimeout.ts @@ -20,11 +20,13 @@ export default class BushRemoveTimeoutListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Remove Timeout'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${'Remove Timeout'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushTimeout.ts b/src/listeners/member-custom/bushTimeout.ts index d319eb6..07a7105 100644 --- a/src/listeners/member-custom/bushTimeout.ts +++ b/src/listeners/member-custom/bushTimeout.ts @@ -22,12 +22,14 @@ export default class BushTimeoutListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Timeout'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) - .addFields({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${'Timeout'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }, + { name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` } + ]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnban.ts b/src/listeners/member-custom/bushUnban.ts index f7701b2..2628d36 100644 --- a/src/listeners/member-custom/bushUnban.ts +++ b/src/listeners/member-custom/bushUnban.ts @@ -20,11 +20,13 @@ export default class BushUnbanListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Unban'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${'Unban'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnblock.ts b/src/listeners/member-custom/bushUnblock.ts index 4b6ce11..238c5b5 100644 --- a/src/listeners/member-custom/bushUnblock.ts +++ b/src/listeners/member-custom/bushUnblock.ts @@ -20,12 +20,14 @@ export default class BushUnblockListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Unblock'}` }) - .addFields({ name: '**Channel**', value: `<#${channel.id}>` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${'Unblock'}` }, + { name: '**Channel**', value: `<#${channel.id}>` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnmute.ts b/src/listeners/member-custom/bushUnmute.ts index 9857f64..e7f6793 100644 --- a/src/listeners/member-custom/bushUnmute.ts +++ b/src/listeners/member-custom/bushUnmute.ts @@ -20,11 +20,13 @@ export default class BushUnmuteListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Unmute'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${'Unmute'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUpdateModlog.ts b/src/listeners/member-custom/bushUpdateModlog.ts index 2cc5e48..f49defe 100644 --- a/src/listeners/member-custom/bushUpdateModlog.ts +++ b/src/listeners/member-custom/bushUpdateModlog.ts @@ -21,12 +21,14 @@ export default class BushUpdateModlogListener extends BushListener { name: moderator.user.tag, iconURL: moderator.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Update Modlog'}` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - .addFields({ name: '**ModLog Changed**', value: modlogID }) - .addFields({ name: '**Value Changed**', value: key }) - .addFields({ name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldModlog, undefined, undefined, 1024) }) - .addFields({ name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newModlog, undefined, undefined, 1024) }); + .addFields([ + { name: '**Action**', value: `${'Update Modlog'}` }, + { name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }, + { name: '**ModLog Changed**', value: modlogID }, + { name: '**Value Changed**', value: key }, + { name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldModlog, undefined, undefined, 1024) }, + { name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newModlog, undefined, undefined, 1024) } + ]); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushUpdateSettings.ts b/src/listeners/member-custom/bushUpdateSettings.ts index 7c7828e..948bbe7 100644 --- a/src/listeners/member-custom/bushUpdateSettings.ts +++ b/src/listeners/member-custom/bushUpdateSettings.ts @@ -21,12 +21,13 @@ export default class BushUpdateSettingsListener extends BushListener { name: moderator.user.tag, iconURL: moderator.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }); - logEmbed.addFields({ name: '**Action**', value: `${'Update Settings'}` }); - if (moderator) logEmbed.addFields({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }); - logEmbed - .addFields({ name: '**Setting Changed**', value: setting }) - .addFields({ name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldSettings, 'js', undefined, 1024) }) - .addFields({ name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newSettings, 'js', undefined, 1024) }); + logEmbed.addFields([{ name: '**Action**', value: `${'Update Settings'}` }]); + if (moderator) logEmbed.addFields([{ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }]); + logEmbed.addFields([ + { name: '**Setting Changed**', value: setting }, + { name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldSettings, 'js', undefined, 1024) }, + { name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newSettings, 'js', undefined, 1024) } + ]); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushWarn.ts b/src/listeners/member-custom/bushWarn.ts index 724a266..ede56fd 100644 --- a/src/listeners/member-custom/bushWarn.ts +++ b/src/listeners/member-custom/bushWarn.ts @@ -20,11 +20,13 @@ export default class BushWarnListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Warn'}` }) - .addFields({ name: '**User**', value: `${user} (${user.tag})` }) - .addFields({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addFields({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addFields({ name: '**Additional Info**', value: 'Could not dm user.' }); + .addFields([ + { name: '**Action**', value: `${'Warn'}` }, + { name: '**User**', value: `${user} (${user.tag})` }, + { name: '**Moderator**', value: `${moderator} (${moderator.tag})` }, + { name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` } + ]); + if (dmSuccess === false) logEmbed.addFields([{ name: '**Additional Info**', value: 'Could not dm user.' }]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index dd0c8ae..87480b0 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -37,7 +37,7 @@ export default class DirectMessageListener extends BushListener { if (message.attachments.filter((a) => typeof a.size == 'number').size == 1) { dmLogEmbed.setImage(message.attachments.filter((a) => typeof a.size == 'number').first()!.proxyURL); } else if (message.attachments.size > 0) { - dmLogEmbed.addFields({ name: 'Attachments', value: message.attachments.map((a) => a.proxyURL).join('\n') }); + dmLogEmbed.addFields([{ name: 'Attachments', value: message.attachments.map((a) => a.proxyURL).join('\n') }]); } const dmChannel = await util.getConfigChannel('dm'); await dmChannel.send({ embeds: [dmLogEmbed] }); diff --git a/src/listeners/track-manual-punishments/modlogSyncBan.ts b/src/listeners/track-manual-punishments/modlogSyncBan.ts index 106224a..504992f 100644 --- a/src/listeners/track-manual-punishments/modlogSyncBan.ts +++ b/src/listeners/track-manual-punishments/modlogSyncBan.ts @@ -14,8 +14,8 @@ export default class ModlogSyncBanListener extends BushListener { public override async exec(...[ban]: BushClientEvents['guildBanAdd']) { if (!(await ban.guild.hasFeature('logManualPunishments'))) return; - if (!ban.guild.me) return; // bot was banned - if (!ban.guild.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) { + if (!ban.guild.members.me) return; // bot was banned + if (!ban.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) { return ban.guild.error( 'modlogSyncBan', `Could not sync the manual ban of ${ban.user.tag} to the modlog because I do not have the "View Audit Log" permission.` @@ -60,10 +60,12 @@ export default class ModlogSyncBanListener extends BushListener { name: ban.user.tag, iconURL: ban.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Manual Ban'}` }) - .addFields({ name: '**User**', value: `${ban.user} (${ban.user.tag})` }) - .addFields({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addFields({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .addFields([ + { name: '**Action**', value: `${'Manual Ban'}` }, + { name: '**User**', value: `${ban.user} (${ban.user.tag})` }, + { name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }, + { name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` } + ]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/track-manual-punishments/modlogSyncKick.ts b/src/listeners/track-manual-punishments/modlogSyncKick.ts index cff397b..7a2c154 100644 --- a/src/listeners/track-manual-punishments/modlogSyncKick.ts +++ b/src/listeners/track-manual-punishments/modlogSyncKick.ts @@ -13,8 +13,8 @@ export default class ModlogSyncKickListener extends BushListener { public override async exec(...[member]: BushClientEvents['guildMemberRemove']) { if (!(await member.guild.hasFeature('logManualPunishments'))) return; - if (!member.guild.me) return; // bot was removed from guild - if (!member.guild.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) { + if (!member.guild.members.me) return; // bot was removed from guild + if (!member.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) { return member.guild.error( 'modlogSyncKick', `Could not sync the potential manual kick of ${member.user.tag} to the modlog because I do not have the "View Audit Log" permission.` @@ -59,10 +59,12 @@ export default class ModlogSyncKickListener extends BushListener { name: member.user.tag, iconURL: member.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Manual Kick'}` }) - .addFields({ name: '**User**', value: `${member.user} (${member.user.tag})` }) - .addFields({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addFields({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .addFields([ + { name: '**Action**', value: `${'Manual Kick'}` }, + { name: '**User**', value: `${member.user} (${member.user.tag})` }, + { name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }, + { name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` } + ]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts index 57e7ae6..f6235a9 100644 --- a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts +++ b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts @@ -13,7 +13,7 @@ export default class ModlogSyncTimeoutListener extends BushListener { public override async exec(...[_oldMember, newMember]: BushClientEvents['guildMemberUpdate']) { if (!(await newMember.guild.hasFeature('logManualPunishments'))) return; - if (!newMember.guild.me!.permissions.has(PermissionFlagsBits.ViewAuditLog)) { + if (!newMember.guild.members.me!.permissions.has(PermissionFlagsBits.ViewAuditLog)) { return newMember.guild.error( 'modlogSyncTimeout', `Could not sync the potential manual timeout of ${newMember.user.tag} to the modlog because I do not have the "View Audit Log" permission.` @@ -64,10 +64,12 @@ export default class ModlogSyncTimeoutListener extends BushListener { name: newMember.user.tag, iconURL: newMember.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${newTime ? 'Manual Timeout' : 'Manual Remove Timeout'}` }) - .addFields({ name: '**User**', value: `${newMember.user} (${newMember.user.tag})` }) - .addFields({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addFields({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .addFields([ + { name: '**Action**', value: `${newTime ? 'Manual Timeout' : 'Manual Remove Timeout'}` }, + { name: '**User**', value: `${newMember.user} (${newMember.user.tag})` }, + { name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }, + { name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` } + ]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/track-manual-punishments/modlogSyncUnban.ts b/src/listeners/track-manual-punishments/modlogSyncUnban.ts index f7b9730..cdf18d9 100644 --- a/src/listeners/track-manual-punishments/modlogSyncUnban.ts +++ b/src/listeners/track-manual-punishments/modlogSyncUnban.ts @@ -14,7 +14,7 @@ export default class ModlogSyncUnbanListener extends BushListener { public override async exec(...[ban]: BushClientEvents['guildBanRemove']) { if (!(await ban.guild.hasFeature('logManualPunishments'))) return; - if (!ban.guild.me!.permissions.has(PermissionFlagsBits.ViewAuditLog)) { + if (!ban.guild.members.me!.permissions.has(PermissionFlagsBits.ViewAuditLog)) { return ban.guild.error( 'modlogSyncBan', `Could not sync the manual unban of ${ban.user.tag} to the modlog because I do not have the "View Audit Log" permission.` @@ -59,10 +59,12 @@ export default class ModlogSyncUnbanListener extends BushListener { name: ban.user.tag, iconURL: ban.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addFields({ name: '**Action**', value: `${'Manual Unban'}` }) - .addFields({ name: '**User**', value: `${ban.user} (${ban.user.tag})` }) - .addFields({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addFields({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .addFields([ + { name: '**Action**', value: `${'Manual Unban'}` }, + { name: '**User**', value: `${ban.user} (${ban.user.tag})` }, + { name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }, + { name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` } + ]); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts index 76b5a0e..6bd37fc 100644 --- a/src/listeners/ws/INTERACTION_CREATE.ts +++ b/src/listeners/ws/INTERACTION_CREATE.ts @@ -199,18 +199,20 @@ export default class WsInteractionCreateListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${modlogCase}` }) .setAuthor({ name: user.tag, iconURL: user.displayAvatarURL() }) - .addFields({ - name: `Why were you ${Moderation.punishmentToPastTense(punishment)}?`, - value: interaction.data.components![0].components[0]!.value.substring(0, 1024) - }) - .addFields({ - name: 'Do you believe it was fair?', - value: interaction.data.components![1].components[0]!.value.substring(0, 1024) - }) - .addFields({ - name: `Why should your ${punishment} be removed?`, - value: interaction.data.components![2].components[0]!.value.substring(0, 1024) - }) + .addFields([ + { + name: `Why were you ${Moderation.punishmentToPastTense(punishment)}?`, + value: interaction.data.components![0].components[0]!.value.substring(0, 1024) + }, + { + name: 'Do you believe it was fair?', + value: interaction.data.components![1].components[0]!.value.substring(0, 1024) + }, + { + name: `Why should your ${punishment} be removed?`, + value: interaction.data.components![2].components[0]!.value.substring(0, 1024) + } + ]) .toJSON() as APIEmbed; const components = [ |