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/listeners | |
parent | 6b8115ab1ec94d4330019fc7a93e094d9d64c48e (diff) | |
download | tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.gz tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.tar.bz2 tanzanite-9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c.zip |
fix: breaking changes
Diffstat (limited to 'src/listeners')
29 files changed, 198 insertions, 156 deletions
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 = [ |