Replaced clang format with prettuier (sadly)

This commit is contained in:
2023-12-28 16:47:52 +01:00
parent ca5bbd0b81
commit 117140fe9d
99 changed files with 13519 additions and 12011 deletions

View File

@@ -1,4 +1,9 @@
import { SlashCommandBuilder, PermissionFlagsBits, ChannelType, GuildTextBasedChannel } from "discord.js"
import {
SlashCommandBuilder,
PermissionFlagsBits,
ChannelType,
GuildTextBasedChannel,
} from "discord.js"
import { color } from "../../config/options.json"
import { Command } from "../interfaces"
@@ -16,12 +21,12 @@ export = {
option
.setName("amount")
.setDescription("Amount of messages to clear")
.setRequired(true))
.setRequired(true),
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply({ ephemeral: true })
const amount = interaction.options.getInteger("amount")!
@@ -30,40 +35,50 @@ export = {
if (!amount || amount < 1 || amount > 100) {
await interaction.editReply({
embeds: [{
description: "Please provide an amount of messages to clear",
color: embedColor
}],
embeds: [
{
description:
"Please provide an amount of messages to clear",
color: embedColor,
},
],
})
}
if (channel2.type !== ChannelType.GuildText) {
await interaction.editReply({
embeds: [{
description: "You can only clear messages in a text channel",
color: embedColor
}],
embeds: [
{
description:
"You can only clear messages in a text channel",
color: embedColor,
},
],
})
}
const channel = channel2 as GuildTextBasedChannel
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 interaction.editReply({
embeds: [{
description: `Deleted ${messages.size} messages`,
color: embedColor
}],
embeds: [
{
description: `Deleted ${messages.size} messages`,
color: embedColor,
},
],
})
})
}
} as Command
},
} as Command