diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-03-03 23:45:16 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-03-03 23:45:16 -0500 |
commit | 3c56bbcf795725b65192409b3211d92c097f8c82 (patch) | |
tree | 472dafca0224e61aeaffcf59ea176c534b8c3930 | |
parent | 2e02220de1d1de24375db11f22b4c6626c930a28 (diff) | |
download | tanzanite-3c56bbcf795725b65192409b3211d92c097f8c82.tar.gz tanzanite-3c56bbcf795725b65192409b3211d92c097f8c82.tar.bz2 tanzanite-3c56bbcf795725b65192409b3211d92c097f8c82.zip |
refactor: preemptively switch addField to addFields
47 files changed, 278 insertions, 198 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 6cb493d..88e83ec 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -369,7 +369,7 @@ 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.addField({ + settingsEmbed.addFields({ name: 'value', value: (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]' }); diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index a6221c9..8742246 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -254,8 +254,8 @@ export default class EvalCommand extends BushCommand { embed.setTimestamp(); - if (inputTS) embed.addField({ name: ':inbox_tray: Input (typescript)', value: inputTS }); - embed.addField({ 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, @@ -270,10 +270,10 @@ export default class EvalCommand extends BushCommand { embed .setTitle(`${emojis[err ? 'errorFull' : 'successFull']} ${err ? 'Uns' : 'S'}uccessfully Evaluated Expression`) .setColor(colors[err ? 'error' : 'success']) - .addField({ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }); + .addFields({ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }); - if (!err && methods) embed.addField({ name: ':wrench: Methods', value: methods }); - if (!err && proto) embed.addField({ 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 3ede3e2..b0ba0c4 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -67,12 +67,12 @@ export default class JavascriptCommand extends BushCommand { }); embed.setTitle(`${util.emojis.successFull} Successfully Evaluated Expression`).setColor(util.colors.success); - embed.addField({ name: '📥 Input', value: input }); - embed.addField({ name: '📤 Output', value: output }); + embed.addFields({ name: '📥 Input', value: input }); + embed.addFields({ name: '📤 Output', value: output }); } catch (e) { embed.setTitle(`${util.emojis.errorFull} Unable to Evaluate Expression`).setColor(util.colors.error); - embed.addField({ name: '📥 Input', value: input }); - embed.addField({ name: '📤 Error', value: await util.inspectCleanRedactCodeblock(e, 'js') }); + embed.addFields({ name: '📥 Input', value: input }); + embed.addFields({ 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 7d29df7..7134b6b 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -50,8 +50,8 @@ export default class ShCommand extends BushCommand { .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() .setTitle('Shell Command') - .addField({ name: '📥 Input', value: await util.codeblock(input, 1024, 'sh', true) }) - .addField({ name: 'Running', value: util.emojis.loading }); + .addFields({ name: '📥 Input', value: await util.codeblock(input, 1024, 'sh', true) }) + .addFields({ name: 'Running', value: util.emojis.loading }); await message.util.reply({ embeds: [embed] }); @@ -72,15 +72,15 @@ export default class ShCommand extends BushCommand { .setColor(util.colors.success) .spliceFields(1, 1); - if (stdout) embed.addField({ name: '📤 stdout', value: await util.codeblock(stdout, 1024, 'json', true) }); - if (stderr) embed.addField({ 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.addField({ 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 8c76ded..cca40a6 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -63,7 +63,7 @@ export default class TestCommand extends BushCommand { return await message.util.reply({ content: 'buttons', components: [ButtonRow] }); } else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) { const embed = new Embed() - .addField({ 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') diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index d23f5b1..4d914e4 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -41,8 +41,8 @@ export default class BotInfoCommand extends BushCommand { if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4); const embed = new Embed() .setTitle('Bot Info:') - .addField({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }) - .addField({ + .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 @@ -52,23 +52,23 @@ export default class BotInfoCommand extends BushCommand { )}`, inline: true }) - .addField({ name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true }) - .addField({ name: '**Platform**', value: Platform[process.platform], inline: true }) - .addField({ name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true }) - .addField({ name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true }) - .addField({ name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true }) - .addField({ name: '**Discord.js Version**', value: discordJSVersion, inline: true }) - .addField({ name: '**Node.js Version**', value: process.version.slice(1), inline: true }) - .addField({ name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true }) - .addField({ name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true }) - .addField({ name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true }) - .addField({ name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true }) - .addField({ + .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 }) - .addField({ name: '**Developers**', value: developers, inline: true }) + .addFields({ 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 6aad1fe..49e827d 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -76,10 +76,10 @@ export default class ColorCommand extends BushCommand { } const embed = new Embed() - .addField({ name: '» Hexadecimal', value: color.toHexString() }) - .addField({ name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` }) - .addField({ name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }) - .addField({ name: '» RGB', value: this.removePrefixAndParenthesis(color.toRgbString()) }) + .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()) }) .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 ed8a973..7f82e92 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -155,7 +155,7 @@ export default class GuildInfoCommand extends BushCommand { ); } - embed.addField({ name: '» About', value: guildAbout.join('\n') }); + embed.addFields({ name: '» About', value: guildAbout.join('\n') }); } private generateStatsField(embed: Embed, guild: Guild | GuildPreview) { @@ -191,7 +191,7 @@ export default class GuildInfoCommand extends BushCommand { `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${StickerTierMap[guild.premiumTier]}` ); - embed.addField({ name: '» Stats', value: guildStats.join('\n') }); + embed.addFields({ name: '» Stats', value: guildStats.join('\n') }); } private generateSecurityField(embed: Embed, guild: Guild | GuildPreview) { @@ -206,7 +206,7 @@ export default class GuildInfoCommand extends BushCommand { `**2FA Required:** ${guild.mfaLevel === GuildMFALevel.Elevated ? 'True' : 'False'}` ); - embed.addField({ 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 15c447a..04abd18 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.addField({ 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,18 @@ 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.addField({ + embed.addFields({ name: `» Usage${command.usage.length > 1 ? 's' : ''}`, value: command.usage.map((u) => `\`${u}\``).join('\n') }); } if (command.examples?.length) { - embed.addField({ + embed.addFields({ name: `» Example${command.examples.length > 1 ? 's' : ''}`, value: command.examples.map((u) => `\`${u}\``).join('\n') }); } - if (command.aliases?.length > 1) embed.addField({ 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 +132,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.addField({ 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 }; diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index c767361..1b5e45a 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -22,8 +22,8 @@ export default class PingCommand extends BushCommand { const apiLatency = `${'```'}\n ${Math.round(message.client.ws.ping)}ms ${'```'}`; const embed = new Embed() .setTitle('Pong! 🏓') - .addField({ name: 'Bot Latency', value: botLatency, inline: true }) - .addField({ name: 'API Latency', value: apiLatency, inline: true }) + .addFields({ name: 'Bot Latency', value: botLatency, inline: true }) + .addFields({ name: 'API Latency', value: apiLatency, inline: true }) .setFooter({ text: message.author.username, iconURL: message.author.displayAvatarURL() }) .setColor(util.colors.default) .setTimestamp(); @@ -41,8 +41,8 @@ export default class PingCommand extends BushCommand { const apiLatency = `${'```'}\n ${Math.round(client.ws.ping)}ms ${'```'}`; const embed = new Embed() .setTitle('Pong! 🏓') - .addField({ name: 'Bot Latency', value: botLatency, inline: true }) - .addField({ name: 'API Latency', value: apiLatency, inline: true }) + .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() diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index 3295960..c64a286 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -61,7 +61,7 @@ export default class SnowflakeCommand extends BushCommand { ); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(channel.name)} \`[Channel]\``); } - snowflakeEmbed.addField({ name: '» Channel Info', value: channelInfo.join('\n') }); + snowflakeEmbed.addFields({ name: '» Channel Info', value: channelInfo.join('\n') }); } // Guild @@ -75,7 +75,7 @@ export default class SnowflakeCommand extends BushCommand { `**Members:** ${guild.memberCount?.toLocaleString()}` ]; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!); - snowflakeEmbed.addField({ 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]\``); } @@ -85,7 +85,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.addField({ 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]\``); } @@ -97,7 +97,7 @@ export default class SnowflakeCommand extends BushCommand { `**Animated:** ${emoji.animated}` ]; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); - snowflakeEmbed.addField({ 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]\``); } @@ -113,7 +113,7 @@ export default class SnowflakeCommand extends BushCommand { `**Hex Color:** ${role.hexColor}` ]; if (role.color) snowflakeEmbed.setColor(role.color); - snowflakeEmbed.addField({ 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]\``); } @@ -126,7 +126,7 @@ export default class SnowflakeCommand extends BushCommand { `**Process ID:** ${deconstructedSnowflake.processId}`, `**Increment:** ${deconstructedSnowflake.increment}` ]; - snowflakeEmbed.addField({ 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 0ff8611..a09d8ca 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -132,7 +132,7 @@ export default class UserInfoCommand extends BushCommand { if (pronouns && typeof pronouns === 'string' && pronouns !== 'Unspecified') generalInfo.push(`**Pronouns:** ${pronouns}`); - embed.addField({ name: '» General Info', value: generalInfo.join('\n') }); + embed.addFields({ name: '» General Info', value: generalInfo.join('\n') }); } private static generateServerInfoField(embed: Embed, member?: BushGuildMember | undefined) { @@ -156,7 +156,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.addField({ name: '» Server Info', value: serverUserInfo.join('\n') }); + if (serverUserInfo.length) embed.addFields({ name: '» Server Info', value: serverUserInfo.join('\n') }); } private static generatePresenceField(embed: Embed, member?: BushGuildMember | undefined) { @@ -184,7 +184,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.addField({ name: '» Presence', value: presenceInfo.join('\n') }); + embed.addFields({ name: '» Presence', value: presenceInfo.join('\n') }); enum statusEmojis { online = '787550449435803658', @@ -207,7 +207,7 @@ export default class UserInfoCommand extends BushCommand { .filter((role) => role.name !== '@everyone') .sort((role1, role2) => role2.position - role1.position) .map((role) => `${role}`); - embed.addField({ name: `» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, value: roles.join(', ') }); + embed.addFields({ name: `» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, value: roles.join(', ') }); } private static generatePermissionsField(embed: Embed, member: BushGuildMember | undefined) { @@ -225,7 +225,7 @@ export default class UserInfoCommand extends BushCommand { }); } - if (perms.length) embed.addField({ name: '» Important Perms', value: perms.join(' ') }); + if (perms.length) embed.addFields({ name: '» Important Perms', value: perms.join(' ') }); } private static async generateBotField(embed: Embed, user: BushUser) { @@ -275,6 +275,6 @@ export default class UserInfoCommand extends BushCommand { ); } - if (botInfo.length) embed.addField({ name: '» Bot Info', value: botInfo.join('\n') }); + if (botInfo.length) embed.addFields({ name: '» Bot Info', value: botInfo.join('\n') }); } } diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index fc78a7b..ed25df4 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -71,7 +71,7 @@ export default class ReportCommand extends BushCommand { .setTitle('New Report') .setColor(util.colors.red) .setDescription(evidence) - .addField({ + .addFields({ name: 'Reporter', value: [ `**Name:**${message.author.tag} <@${message.author.id}>`, @@ -81,7 +81,7 @@ export default class ReportCommand extends BushCommand { ].join('\n'), inline: true }) - .addField({ + .addFields({ name: 'Reported User', value: [ `**Name:**${member.user.tag} <@${member.user.id}>`, @@ -96,7 +96,7 @@ export default class ReportCommand extends BushCommand { if (fileName.endsWith('.png') || fileName.endsWith('.jpg') || fileName.endsWith('.gif') || fileName.endsWith('.webp')) { reportEmbed.setImage(message.attachments.first()!.url); } else { - reportEmbed.addField({ 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 5eb2b98..913a4b6 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -108,10 +108,10 @@ export default class RuleCommand extends BushCommand { } if (rule) { if (rules[rule - 1]?.title && rules[rule - 1]?.description) - rulesEmbed.addField({ 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.addField({ 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 35240f9..703dfc4 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 - .addField({ 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,7 +46,7 @@ export default class ServerStatusCommand extends BushCommand { await message.util.edit({ embeds: [ msgEmbed - .addField({ + .addFields({ name: 'Status', value: "It appears Moulberry's server is offline, this means that everything related to prices will likely not work." diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index 7492fc5..75dc63f 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -31,7 +31,7 @@ export default class CalculatorCommand extends BushCommand { } public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) { - const decodedEmbed = new Embed().addField({ + const decodedEmbed = new Embed().addFields({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(args.expression, 'mma') }); @@ -40,12 +40,12 @@ export default class CalculatorCommand extends BushCommand { decodedEmbed .setTitle(`${util.emojis.successFull} Successfully Calculated Expression`) .setColor(util.colors.success) - .addField({ 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) - .addField({ 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 00420da..1d64145 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -55,14 +55,14 @@ export default class DecodeCommand extends BushCommand { const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias ?? 'decoded'); const decodedEmbed = new Embed() .setTitle(`${encodeOrDecode} Information`) - .addField({ 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) - .addField({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(decoded) }); + .addFields({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(decoded) }); } catch (error) { - decodedEmbed.setColor(util.colors.error).addField({ + decodedEmbed.setColor(util.colors.error).addFields({ name: `📤 Error ${encodeOrDecode.slice(1)}ing`, value: await util.inspectCleanRedactCodeblock(error?.stack ?? error) }); diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts index c3c6723..7058675 100644 --- a/src/commands/utilities/highlight-show.ts +++ b/src/commands/utilities/highlight-show.ts @@ -39,7 +39,7 @@ export default class HighlightShowCommand extends BushCommand { .setColor(util.colors.default); if (highlight.blacklistedChannels.length) - embed.addField({ + embed.addFields({ name: 'Ignored Channels', value: highlight.blacklistedChannels .map((c) => `<#${c}>`) @@ -48,7 +48,7 @@ export default class HighlightShowCommand extends BushCommand { inline: true }); if (highlight.blacklistedUsers.length) - embed.addField({ + embed.addFields({ name: 'Ignored Users', value: highlight.blacklistedUsers .map((u) => `<@!${u}>`) diff --git a/src/commands/utilities/poll.ts b/src/commands/utilities/poll.ts new file mode 100644 index 0000000..e53eb51 --- /dev/null +++ b/src/commands/utilities/poll.ts @@ -0,0 +1,80 @@ +import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import { ApplicationCommandOptionType, ComponentType } from 'discord.js'; + +export default class PollCommand extends BushCommand { + public constructor() { + super('poll', { + aliases: ['poll', 'quick-poll'], + category: 'utilities', + description: 'Allows you to create a poll that other users can vote on. Separate options with "," or "|".', + usage: ['poll options'], + examples: ['poll 1 2'], + args: [ + { + id: 'question', + description: 'The question to be answered by a poll.', + type: 'string', + prompt: 'What question would you like to ask?', + retry: '{error} Choose a question.', + slashType: ApplicationCommandOptionType.String, + only: 'slash' + }, + { + id: 'options', + description: 'The options to include in the poll. Separate options with "," or "|".', + type: 'string', + prompt: 'What options you want to include in the poll? Separate options with "," or "|".', + retry: '{error} Choose options for the poll. Separate options with "," or "|".', + slashType: ApplicationCommandOptionType.String + } + ], + slash: true, + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [] + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, args: { question?: string; options: ArgType<'string'> }) { + const { question, options } = this.parseArgs(message, args); + if (!question || !options.length) return; + + if (question.length > 256) return await message.util.reply(`${util.emojis.error} Question must be 256 characters or less.`); + if (options.length > 10) return await message.util.reply(`${util.emojis.error} You can only have upto 10 options.`); + + return message.util.send({ + embeds: [ + { + author: { name: `asked by: ${message.author.tag}`, icon_url: message.author.displayAvatarURL() || undefined }, + title: question + } + ], + components: [ + { + type: ComponentType.ActionRow, + components: [] + } + ] + }); + } + + private parseArgs( + message: BushMessage | BushSlashMessage, + args: { question?: string; options: ArgType<'string'> } + ): { question: string; options: string[] } { + const split = args.options.split(/[,|]/).filter((s) => s.trim().length > 0); + if (message.util.isSlash) { + if (split.length < 2) { + void message.util.reply(`${util.emojis.error} You must provide at least two options.`); + return { question: '', options: [] }; + } + return { question: args.question!, options: split }; + } else { + if (split.length < 3) { + void message.util.reply(`${util.emojis.error} You must provide a question and at least two options.`); + return { question: '', options: [] }; + } + + return { question: split[0], options: split.slice(1) }; + } + } +} diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index b0a7428..2af6a76 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -89,14 +89,14 @@ export default class PriceCommand extends BushCommand { const bazaarPriceEmbed = new Embed() .setColor(errors?.length ? util.colors.warn : util.colors.success) .setTitle(`Bazaar Information for ${util.format.input(parsedItem)}`) - .addField({ name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) }) - .addField({ name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) }) - .addField({ + .addFields({ name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) }) + .addFields({ name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) }) + .addFields({ name: 'Margin', value: (+addBazaarInformation('buyPrice', 2, false) - +addBazaarInformation('sellPrice', 2, false)).toLocaleString() }) - .addField({ name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) }) - .addField({ name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) }); + .addFields({ name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) }) + .addFields({ name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) }); return await message.util.reply({ embeds: [bazaarPriceEmbed] }); } @@ -138,7 +138,7 @@ export default class PriceCommand extends BushCommand { } function addPrice(name: string, price: number | undefined) { if (price) - priceEmbed.addField({ + 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 693896d..be6730b 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -26,7 +26,7 @@ export default class SuicideCommand extends BushCommand { iconURL: 'https://media.discordapp.net/attachments/770256340639416320/854689949193076737/Medical_31-60_974.jpg?width=523&height=523' }) - .addField({ + .addFields({ name: '**National Suicide Prevention Hotline (U.S.):**', value: [ '**Call:** 1-800-273-8255, available 24/7 for emotional support', @@ -36,7 +36,7 @@ export default class SuicideCommand extends BushCommand { '**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') }) - .addField({ + .addFields({ name: '**More Support**', value: [ 'For Substance Abuse Support, Eating Disorder Support & Child Abuse and Domestic Violence:', diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index f8e5c22..948aec6 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -45,7 +45,7 @@ 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 Embed().addField({ + const decodedEmbed = new Embed().addFields({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(args.expression) }); @@ -58,15 +58,15 @@ export default class WolframAlphaCommand extends BushCommand { if (args.image) { decodedEmbed.setImage(await util.uploadImageToImgur(calculated.split(',')[1])); - decodedEmbed.addField({ name: '📤 Output', value: '' }); + decodedEmbed.addFields({ name: '📤 Output', value: '' }); } else { - decodedEmbed.addField({ 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) - .addField({ 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 93d2f8f..db3e709 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -158,7 +158,7 @@ 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})` ) - .addField({ 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() ], @@ -323,7 +323,7 @@ export class AutoMod { this.message.channel.id }> [Jump to context](${this.message.url})\n**Blacklisted Words:** ${offences.map((o) => `\`${o.match}\``).join(', ')}` ) - .addField({ 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() }) diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index d8b33aa..83bb327 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.addField({ 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 badbb39..b27dfba 100644 --- a/src/listeners/guild-custom/bushLockdown.ts +++ b/src/listeners/guild-custom/bushLockdown.ts @@ -17,10 +17,10 @@ export default class BushLockdownListener extends BushListener { const logEmbed = new Embed() .setColor(util.colors.Blurple) .setTimestamp() - .addField({ name: '**Action**', value: `${'Lockdown'}` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) - .addField({ + .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}`) diff --git a/src/listeners/guild-custom/bushUnlockdown.ts b/src/listeners/guild-custom/bushUnlockdown.ts index c7d9158..0de83d2 100644 --- a/src/listeners/guild-custom/bushUnlockdown.ts +++ b/src/listeners/guild-custom/bushUnlockdown.ts @@ -17,10 +17,10 @@ export default class BushUnlockdownListener extends BushListener { const logEmbed = new Embed() .setColor(util.colors.Blurple) .setTimestamp() - .addField({ name: '**Action**', value: `${'Unlockdown'}` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) - .addField({ + .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}`) diff --git a/src/listeners/member-custom/bushBan.ts b/src/listeners/member-custom/bushBan.ts index 12e8694..cd700a9 100644 --- a/src/listeners/member-custom/bushBan.ts +++ b/src/listeners/member-custom/bushBan.ts @@ -20,12 +20,12 @@ export default class BushBanListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${duration ? 'Temp Ban' : 'Perm Ban'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (duration) logEmbed.addField({ name: '**Duration**', value: util.humanizeDuration(duration) }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushBlock.ts b/src/listeners/member-custom/bushBlock.ts index e35b5a3..111c945 100644 --- a/src/listeners/member-custom/bushBlock.ts +++ b/src/listeners/member-custom/bushBlock.ts @@ -22,14 +22,14 @@ export default class BushBlockListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${duration ? 'Temp Block' : 'Perm Block'}` }) - .addField({ name: '**Channel**', value: `<#${channel.id}>` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + .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]'}` }); - if (duration) logEmbed.addField({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); - if (dmSuccess === false) logEmbed.addField({ 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 97db7e4..f3e5df1 100644 --- a/src/listeners/member-custom/bushKick.ts +++ b/src/listeners/member-custom/bushKick.ts @@ -20,11 +20,11 @@ export default class BushKickListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Kick'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushMute.ts b/src/listeners/member-custom/bushMute.ts index 8b80658..6f05fcc 100644 --- a/src/listeners/member-custom/bushMute.ts +++ b/src/listeners/member-custom/bushMute.ts @@ -20,12 +20,12 @@ export default class BushMuteListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${duration ? 'Temp Mute' : 'Perm Mute'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (duration) logEmbed.addField({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushPunishRole.ts b/src/listeners/member-custom/bushPunishRole.ts index 1c9dcce..b3eeef0 100644 --- a/src/listeners/member-custom/bushPunishRole.ts +++ b/src/listeners/member-custom/bushPunishRole.ts @@ -20,11 +20,11 @@ export default class BushPunishRoleListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (duration) logEmbed.addField({ name: '**Duration**', value: util.humanizeDuration(duration) }); + .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) }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushPunishRoleRemove.ts b/src/listeners/member-custom/bushPunishRoleRemove.ts index 5039370..22b17a7 100644 --- a/src/listeners/member-custom/bushPunishRoleRemove.ts +++ b/src/listeners/member-custom/bushPunishRoleRemove.ts @@ -20,11 +20,11 @@ export default class BushPunishRoleRemoveListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Remove Punishment Role'}` }) - .addField({ name: '**Role**', value: `${role}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + .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]'}` }); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushPurge.ts b/src/listeners/member-custom/bushPurge.ts index 6f61fea..2834397 100644 --- a/src/listeners/member-custom/bushPurge.ts +++ b/src/listeners/member-custom/bushPurge.ts @@ -28,10 +28,10 @@ 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 }) - .addField({ name: '**Action**', value: `${'Purge'}` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Channel**', value: `<#${channel.id}> (${channel.name})` }) - .addField({ + .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}` diff --git a/src/listeners/member-custom/bushRemoveTimeout.ts b/src/listeners/member-custom/bushRemoveTimeout.ts index bb6d463..f2a20ed 100644 --- a/src/listeners/member-custom/bushRemoveTimeout.ts +++ b/src/listeners/member-custom/bushRemoveTimeout.ts @@ -20,11 +20,11 @@ export default class BushRemoveTimeoutListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Remove Timeout'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushTimeout.ts b/src/listeners/member-custom/bushTimeout.ts index 2887104..d0eedf2 100644 --- a/src/listeners/member-custom/bushTimeout.ts +++ b/src/listeners/member-custom/bushTimeout.ts @@ -22,12 +22,12 @@ export default class BushTimeoutListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Timeout'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) - .addField({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnban.ts b/src/listeners/member-custom/bushUnban.ts index a3bc7cf..a3370c8 100644 --- a/src/listeners/member-custom/bushUnban.ts +++ b/src/listeners/member-custom/bushUnban.ts @@ -20,11 +20,11 @@ export default class BushUnbanListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Unban'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnblock.ts b/src/listeners/member-custom/bushUnblock.ts index fde3ad8..19d7fad 100644 --- a/src/listeners/member-custom/bushUnblock.ts +++ b/src/listeners/member-custom/bushUnblock.ts @@ -20,12 +20,12 @@ export default class BushUnblockListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Unblock'}` }) - .addField({ name: '**Channel**', value: `<#${channel.id}>` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnmute.ts b/src/listeners/member-custom/bushUnmute.ts index ad9ae6e..791fa19 100644 --- a/src/listeners/member-custom/bushUnmute.ts +++ b/src/listeners/member-custom/bushUnmute.ts @@ -20,11 +20,11 @@ export default class BushUnmuteListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Unmute'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUpdateModlog.ts b/src/listeners/member-custom/bushUpdateModlog.ts index 05a5f8e..a8fb277 100644 --- a/src/listeners/member-custom/bushUpdateModlog.ts +++ b/src/listeners/member-custom/bushUpdateModlog.ts @@ -21,12 +21,12 @@ export default class BushUpdateModlogListener extends BushListener { name: moderator.user.tag, iconURL: moderator.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Update Modlog'}` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - .addField({ name: '**ModLog Changed**', value: modlogID }) - .addField({ name: '**Value Changed**', value: key }) - .addField({ name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldModlog, undefined, undefined, 1024) }) - .addField({ name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newModlog, undefined, undefined, 1024) }); + .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) }); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushUpdateSettings.ts b/src/listeners/member-custom/bushUpdateSettings.ts index c4f71ff..1ce8806 100644 --- a/src/listeners/member-custom/bushUpdateSettings.ts +++ b/src/listeners/member-custom/bushUpdateSettings.ts @@ -21,12 +21,12 @@ export default class BushUpdateSettingsListener extends BushListener { name: moderator.user.tag, iconURL: moderator.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }); - logEmbed.addField({ name: '**Action**', value: `${'Update Settings'}` }); - if (moderator) logEmbed.addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }); + logEmbed.addFields({ name: '**Action**', value: `${'Update Settings'}` }); + if (moderator) logEmbed.addFields({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }); logEmbed - .addField({ name: '**Setting Changed**', value: setting }) - .addField({ name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldSettings, 'js', undefined, 1024) }) - .addField({ name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newSettings, 'js', undefined, 1024) }); + .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) }); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushWarn.ts b/src/listeners/member-custom/bushWarn.ts index 229438c..c22f61f 100644 --- a/src/listeners/member-custom/bushWarn.ts +++ b/src/listeners/member-custom/bushWarn.ts @@ -20,11 +20,11 @@ export default class BushWarnListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Warn'}` }) - .addField({ name: '**User**', value: `${user} (${user.tag})` }) - .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) - .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); + .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.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index c333e22..df4d578 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.addField({ 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 16fa75d..7d77a76 100644 --- a/src/listeners/track-manual-punishments/modlogSyncBan.ts +++ b/src/listeners/track-manual-punishments/modlogSyncBan.ts @@ -58,10 +58,10 @@ export default class ModlogSyncBanListener extends BushListener { name: ban.user.tag, iconURL: ban.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Manual Ban'}` }) - .addField({ name: '**User**', value: `${ban.user} (${ban.user.tag})` }) - .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .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]'}` }); 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 fa7a6dd..7841686 100644 --- a/src/listeners/track-manual-punishments/modlogSyncKick.ts +++ b/src/listeners/track-manual-punishments/modlogSyncKick.ts @@ -58,10 +58,10 @@ export default class ModlogSyncKickListener extends BushListener { name: member.user.tag, iconURL: member.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Manual Kick'}` }) - .addField({ name: '**User**', value: `${member.user} (${member.user.tag})` }) - .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .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]'}` }); 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 4d7f901..8a2c486 100644 --- a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts +++ b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts @@ -63,10 +63,10 @@ export default class ModlogSyncTimeoutListener extends BushListener { name: newMember.user.tag, iconURL: newMember.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${newTime ? 'Manual Timeout' : 'Manual Remove Timeout'}` }) - .addField({ name: '**User**', value: `${newMember.user} (${newMember.user.tag})` }) - .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .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]'}` }); 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 680b965..70c7ba8 100644 --- a/src/listeners/track-manual-punishments/modlogSyncUnban.ts +++ b/src/listeners/track-manual-punishments/modlogSyncUnban.ts @@ -57,10 +57,10 @@ export default class ModlogSyncUnbanListener extends BushListener { name: ban.user.tag, iconURL: ban.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined }) - .addField({ name: '**Action**', value: `${'Manual Unban'}` }) - .addField({ name: '**User**', value: `${ban.user} (${ban.user.tag})` }) - .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) - .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); + .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]'}` }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts index 1c79406..c245418 100644 --- a/src/listeners/ws/INTERACTION_CREATE.ts +++ b/src/listeners/ws/INTERACTION_CREATE.ts @@ -198,15 +198,15 @@ export default class WsInteractionCreateListener extends BushListener { .setTimestamp() .setFooter({ text: `CaseID: ${modlogCase}` }) .setAuthor({ name: user.tag, iconURL: user.displayAvatarURL() }) - .addField({ + .addFields({ name: `Why were you ${Moderation.punishmentToPastTense(punishment)}?`, value: interaction.data.components![0].components[0]!.value.substring(0, 1024) }) - .addField({ + .addFields({ name: 'Do you believe it was fair?', value: interaction.data.components![1].components[0]!.value.substring(0, 1024) }) - .addField({ + .addFields({ name: `Why should your ${punishment} be removed?`, value: interaction.data.components![2].components[0]!.value.substring(0, 1024) }) |