Fixed more formatting
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
TextChannel,
|
||||
channelMention,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, TextChannel, channelMention, userMention } from "discord.js"
|
||||
import { color } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
@@ -22,7 +16,7 @@ export = {
|
||||
option
|
||||
.setName("amount")
|
||||
.setDescription("Amount of messages to clear")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -36,62 +30,52 @@ export = {
|
||||
|
||||
if (amount < 1 || amount > 100) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Please provide an amount of messages to clear between 1 and 100.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Please provide an amount of messages to clear between 1 and 100.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
channel.messages.fetch({ limit: amount }).then(async messages => {
|
||||
const messagesToDelete = messages
|
||||
.map(m => m)
|
||||
.filter(
|
||||
m =>
|
||||
m.pinned === false &&
|
||||
m.system === false &&
|
||||
m.createdTimestamp > Date.now() - 1209600000,
|
||||
)
|
||||
const messagesToDelete = messages.map(m => m).filter(m =>
|
||||
m.pinned === false &&
|
||||
m.system === false &&
|
||||
m.createdTimestamp > Date.now() - 1209600000
|
||||
)
|
||||
|
||||
await channel.bulkDelete(messagesToDelete, true)
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined,
|
||||
},
|
||||
title: "Messages Cleared",
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined
|
||||
},
|
||||
title: "Messages Cleared",
|
||||
description: `
|
||||
**Channel:** ${channelMention(channel.id)}
|
||||
**Amount:** \`${messages.size}\` messages
|
||||
**Mod:** ${userMention(interaction.user.id)}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: "ID: " + channel.id,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: "ID: " + channel.id,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: `Deleted ${messages.size} messages`,
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: `Deleted ${messages.size} messages`,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
Reference in New Issue
Block a user