aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:56:23 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:56:23 -0400
commitc8a5bfe694ee6e784a0c5cbe1a7076b1c055249a (patch)
tree30a7020bb1dd339348117dffe23c84c17bf50b8a
parentc4c1d9ffeb179e208792c88dd099caea5030581b (diff)
downloadtanzanite-c8a5bfe694ee6e784a0c5cbe1a7076b1c055249a.tar.gz
tanzanite-c8a5bfe694ee6e784a0c5cbe1a7076b1c055249a.tar.bz2
tanzanite-c8a5bfe694ee6e784a0c5cbe1a7076b1c055249a.zip
remove inline from log fields and fix purge
-rw-r--r--src/commands/moderation/purge.ts18
-rw-r--r--src/lib/extensions/discord.js/BushClientEvents.d.ts2
-rw-r--r--src/listeners/custom/bushBan.ts10
-rw-r--r--src/listeners/custom/bushKick.ts8
-rw-r--r--src/listeners/custom/bushMute.ts10
-rw-r--r--src/listeners/custom/bushPunishRole.ts10
-rw-r--r--src/listeners/custom/bushPunishRoleRemove.ts10
-rw-r--r--src/listeners/custom/bushPurge.ts13
-rw-r--r--src/listeners/custom/bushUnban.ts8
-rw-r--r--src/listeners/custom/bushUnmute.ts8
-rw-r--r--src/listeners/custom/bushWarn.ts8
-rw-r--r--yarn.lock14
12 files changed, 60 insertions, 59 deletions
diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts
index 4ed1ee7..ace72f2 100644
--- a/src/commands/moderation/purge.ts
+++ b/src/commands/moderation/purge.ts
@@ -1,4 +1,5 @@
-import { Message } from 'discord.js';
+import Collection from '@discordjs/collection';
+import { Snowflake } from 'discord.js';
import { BushCommand, BushMessage } from '../../lib';
export default class PurgeCommand extends BushCommand {
@@ -52,22 +53,25 @@ export default class PurgeCommand extends BushCommand {
if (args.bot) {
shouldFilter.push(filterMessage.author.bot);
}
- return shouldFilter.filter((bool) => bool === false).length === 0;
+ return shouldFilter.filter((bool) => bool === false).length === 0 && filterMessage.id !== message.id;
};
- const messages = (await message.channel.messages.fetch({ limit: args.amount })).filter((message) => messageFilter(message));
+ const _messages = (await message.channel.messages.fetch({ limit: 100, before: message.id }))
+ .filter((message) => messageFilter(message))
+ .first(args.amount);
+ const messages = new Collection<Snowflake, BushMessage>();
+ _messages.forEach((m) => messages.set(m.id, m));
const purged = await message.channel.bulkDelete(messages, true).catch(() => null);
if (!purged) return message.util.reply(`${util.emojis.error} Failed to purge messages.`).catch(() => null);
else {
client.emit('bushPurge', message.author, message.guild!, message.channel, messages);
- await message.util
- .send(`${util.emojis.success} Successfully purged **${purged.size}** messages.`)
- .then(async (purgeMessage) => {
+ await message.util.send(`${util.emojis.success} Successfully purged **${purged.size}** messages.`);
+ /* .then(async (purgeMessage) => {
if (!message.util.isSlash) {
await util.sleep(5);
await (purgeMessage as Message).delete().catch(() => {});
}
- });
+ }); */
}
}
}
diff --git a/src/lib/extensions/discord.js/BushClientEvents.d.ts b/src/lib/extensions/discord.js/BushClientEvents.d.ts
index 8695e7a..b797698 100644
--- a/src/lib/extensions/discord.js/BushClientEvents.d.ts
+++ b/src/lib/extensions/discord.js/BushClientEvents.d.ts
@@ -118,7 +118,7 @@ export interface BushClientEvents extends ClientEvents {
];
threadMembersUpdate: [
oldMembers: Collection<Snowflake, BushThreadMember>,
- mewMembers: Collection<Snowflake, BushThreadMember>
+ newMembers: Collection<Snowflake, BushThreadMember>
];
threadUpdate: [oldThread: BushThreadChannel, newThread: BushThreadChannel];
typingStart: [typing: Typing];
diff --git a/src/listeners/custom/bushBan.ts b/src/listeners/custom/bushBan.ts
index a7f30a2..df784f2 100644
--- a/src/listeners/custom/bushBan.ts
+++ b/src/listeners/custom/bushBan.ts
@@ -23,11 +23,11 @@ export default class BushBanListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${duration ? 'Temp Ban' : 'Perm Ban'}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
- if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration), true);
+ .addField('**Action**', `${duration ? 'Temp Ban' : 'Perm Ban'}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration));
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushKick.ts b/src/listeners/custom/bushKick.ts
index 3e586f1..f622eba 100644
--- a/src/listeners/custom/bushKick.ts
+++ b/src/listeners/custom/bushKick.ts
@@ -23,10 +23,10 @@ export default class BushKickListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${'Kick'}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
+ .addField('**Action**', `${'Kick'}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushMute.ts b/src/listeners/custom/bushMute.ts
index 9513c20..615d698 100644
--- a/src/listeners/custom/bushMute.ts
+++ b/src/listeners/custom/bushMute.ts
@@ -23,11 +23,11 @@ export default class BushMuteListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${duration ? 'Temp Mute' : 'Perm Mute'}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
- if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration), true);
+ .addField('**Action**', `${duration ? 'Temp Mute' : 'Perm Mute'}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration));
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushPunishRole.ts b/src/listeners/custom/bushPunishRole.ts
index 3e7e98f..ee6c61a 100644
--- a/src/listeners/custom/bushPunishRole.ts
+++ b/src/listeners/custom/bushPunishRole.ts
@@ -23,11 +23,11 @@ export default class BushPunishRoleListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
- if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration), true);
+ .addField('**Action**', `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration));
return await logChannel.send({ embeds: [logEmbed] });
}
}
diff --git a/src/listeners/custom/bushPunishRoleRemove.ts b/src/listeners/custom/bushPunishRoleRemove.ts
index 04d7244..a9d2002 100644
--- a/src/listeners/custom/bushPunishRoleRemove.ts
+++ b/src/listeners/custom/bushPunishRoleRemove.ts
@@ -23,11 +23,11 @@ export default class BushPunishRoleRemoveListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${'Remove Punishment Role'}`, true)
- .addField('**Role**', `${role}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
+ .addField('**Action**', `${'Remove Punishment Role'}`)
+ .addField('**Role**', `${role}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushPurge.ts b/src/listeners/custom/bushPurge.ts
index cc55fc4..240af96 100644
--- a/src/listeners/custom/bushPurge.ts
+++ b/src/listeners/custom/bushPurge.ts
@@ -20,7 +20,7 @@ export default class BushPurgeListener extends BushListener {
author: `${m.author.tag} (${m.id})`,
content: m.content,
embeds: m.embeds,
- attachments: m.attachments
+ attachments: [...m.attachments.values()]
}));
const haste = await util.inspectCleanRedactHaste(mappedMessages);
@@ -28,15 +28,12 @@ export default class BushPurgeListener extends BushListener {
.setColor(util.colors.discord.DARK_PURPLE)
.setTimestamp()
.setFooter(`${messages.size.toLocaleString()} Messages`)
- .addField('**Action**', `${'Purge'}`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Channel**', `<#${channel.id}> (${channel.name})`, true)
+ .addField('**Action**', `${'Purge'}`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Channel**', `<#${channel.id}> (${channel.name})`)
.addField(
'**Messages**',
- `${
- haste.url ? `[haste](${haste.url})${haste.error ? `- ${haste.error}` : ''}` : `${util.emojis.error} ${haste.error}`
- }`,
- true
+ `${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/custom/bushUnban.ts b/src/listeners/custom/bushUnban.ts
index ad82979..1b192f6 100644
--- a/src/listeners/custom/bushUnban.ts
+++ b/src/listeners/custom/bushUnban.ts
@@ -23,10 +23,10 @@ export default class BushUnbanListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${'Unban'}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
+ .addField('**Action**', `${'Unban'}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushUnmute.ts b/src/listeners/custom/bushUnmute.ts
index 8beb27b..9f5d929 100644
--- a/src/listeners/custom/bushUnmute.ts
+++ b/src/listeners/custom/bushUnmute.ts
@@ -23,10 +23,10 @@ export default class BushUnmuteListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${'Unmute'}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
+ .addField('**Action**', `${'Unmute'}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushWarn.ts b/src/listeners/custom/bushWarn.ts
index 40c477c..d093144 100644
--- a/src/listeners/custom/bushWarn.ts
+++ b/src/listeners/custom/bushWarn.ts
@@ -23,10 +23,10 @@ export default class BushWarnListener extends BushListener {
.setTimestamp()
.setFooter(`CaseID: ${caseID}`)
.setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined)
- .addField('**Action**', `${'Warn'}`, true)
- .addField('**User**', `${user} (${user.tag})`, true)
- .addField('**Moderator**', `${moderator} (${moderator.tag})`, true)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true);
+ .addField('**Action**', `${'Warn'}`)
+ .addField('**User**', `${user} (${user.tag})`)
+ .addField('**Moderator**', `${moderator} (${moderator.tag})`)
+ .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/yarn.lock b/yarn.lock
index 1039a6a..9e6833c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1075,9 +1075,9 @@ __metadata:
linkType: hard
"deep-is@npm:^0.1.3":
- version: 0.1.3
- resolution: "deep-is@npm:0.1.3"
- checksum: c15b04c3848a89880c94e25b077c19b47d9a30dd99048e70e5f95d943e7b246bee1da0c1376b56b01bc045be2cae7d9b1c856e68e47e9805634327de7c6cb6d5
+ version: 0.1.4
+ resolution: "deep-is@npm:0.1.4"
+ checksum: edb65dd0d7d1b9c40b2f50219aef30e116cedd6fc79290e740972c132c09106d2e80aa0bc8826673dd5a00222d4179c84b36a790eef63a4c4bca75a37ef90804
languageName: node
linkType: hard
@@ -1136,12 +1136,12 @@ discord-akairo-message-util@NotEnoughUpdates/discord-akairo-message-util:
discord-akairo@NotEnoughUpdates/discord-akairo:
version: 8.2.2
- resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=ec9ff7894fad9cae557c12f18579c73fc004be9f"
+ resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=1ad1f9c476927d5687de93b82bfbd342f4c77b0e"
dependencies:
discord-akairo-message-util: NotEnoughUpdates/discord-akairo-message-util
lodash: ^4.17.21
source-map-support: ^0.5.19
- checksum: fc4a08925050741263dbcf95105a3527d856bce0326449fbe85fb191158f702d566bfe4e7056bb9c524f343ffbdda572fcd0ddd94fcb109c1804475e544f46a8
+ checksum: 4e054c55edec04c1581f503d85111c8218b664b1722eab3aa6d7a944714de0c52e8273d739e5e16cfc6aedec113adb33aacbce0492fa161a23c5f475dd82df98
languageName: node
linkType: hard
@@ -1161,7 +1161,7 @@ discord-akairo@NotEnoughUpdates/discord-akairo:
discord.js@NotEnoughUpdates/discord.js:
version: 13.2.0-dev
- resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=01afa917b9884d0b296765d2be15dad7f23eefbb"
+ resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=e6d983a4b402e2070615fdbe8f02b39dc2721013"
dependencies:
"@discordjs/builders": ^0.5.0
"@discordjs/collection": ^0.2.1
@@ -1171,7 +1171,7 @@ discord.js@NotEnoughUpdates/discord.js:
discord-api-types: ^0.22.0
node-fetch: ^2.6.1
ws: ^7.5.1
- checksum: 80613ceb0f9c4c7650595d98042ef3abf3c305538ebd87bde77c1a52a84f7a4a04e68f485e5288e95f5ea82ec26c184d302de6e55d68bf64b94178c8861764e9
+ checksum: 38235b8743cbfac0b0c256b4164896ffe68a11bd2d127f6664a36ddfc9826edb3d9523d6dbf18fd8e0baf0fde774af02e62d5b271d2d6c62ab8b1ad6b8997a72
languageName: node
linkType: hard