few changes
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index 29c228f..a1c8fe3 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -107,13 +107,15 @@
let amount;
try { amount = parseInt(component.customId); } catch { break; }
let messages;
- (interaction.channel as TextChannel).messages.fetch({limit: amount}).then(async (ms) => {
+ await (interaction.channel as TextChannel).messages.fetch({limit: amount}).then(async (ms) => {
if (user) {
ms = ms.filter(m => m.author.id === user.id)
}
messages = await (channel as TextChannel).bulkDelete(ms, true);
})
- deleted = deleted.concat(messages.map(m => m))
+ if (messages) {
+ deleted = deleted.concat(messages.map(m => m))
+ }
}
if (deleted.length === 0) return await interaction.editReply({
embeds: [
@@ -127,6 +129,28 @@
})
let attachmentObject;
try {
+ // @ts-ignore
+ const { log, NucleusColors, entry, renderUser, renderChannel } = interaction.user.client.logger
+ let data = {
+ meta: {
+ type: 'channelPurge',
+ displayName: 'Channel Purged',
+ calculateType: 'messageDelete',
+ color: NucleusColors.red,
+ emoji: "PUNISH.BAN.RED",
+ timestamp: new Date().getTime()
+ },
+ list: {
+ id: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
+ channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
+ messagesCleared: entry(deleted.length, deleted.length),
+ },
+ hidden: {
+ guild: interaction.guild.id
+ }
+ }
+ log(data, interaction.user.client);
let out = ""
deleted.reverse().forEach(message => {
out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(message.createdTimestamp).toISOString()}]\n`
@@ -177,7 +201,7 @@
.setEmoji("CHANNEL.PURGE.RED")
.setTitle("Purge")
.setDescription(keyValueList({
- "channel": `<#${channel.id}> (${(channel as GuildChannel).name})` + ("[This channel]"),
+ "channel": `<#${channel.id}>`,
"amount": interaction.options.getInteger("amount").toString(),
"reason": `\n> ${interaction.options.getString("reason") ? interaction.options.getString("reason") : "*No reason provided*"}`
}))
@@ -206,6 +230,28 @@
}
let attachmentObject;
try {
+ // @ts-ignore
+ const { log, NucleusColors, entry, renderUser, renderChannel } = interaction.user.client.logger
+ let data = {
+ meta: {
+ type: 'channelPurge',
+ displayName: 'Channel Purged',
+ calculateType: 'messageDelete',
+ color: NucleusColors.red,
+ emoji: "PUNISH.BAN.RED",
+ timestamp: new Date().getTime()
+ },
+ list: {
+ id: entry(interaction.user.id, `\`${interaction.user.id}\``),
+ purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
+ channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
+ messagesCleared: entry(messages.size, messages.size),
+ },
+ hidden: {
+ guild: interaction.guild.id
+ }
+ }
+ log(data, interaction.user.client);
let out = ""
messages.reverse().forEach(message => {
out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(message.createdTimestamp).toISOString()}]\n`