Updated types for channels

This commit is contained in:
2024-01-06 23:28:37 +01:00
parent 2b92750778
commit d06e15c96c
15 changed files with 43 additions and 147 deletions

View File

@@ -1,8 +1,7 @@
import {
SlashCommandBuilder,
PermissionFlagsBits,
ChannelType,
GuildTextBasedChannel,
TextChannel,
} from "discord.js"
import { color } from "../../config/options.json"
import { Command } from "../interfaces"
@@ -30,7 +29,7 @@ export = {
await interaction.deferReply({ ephemeral: true })
const amount = interaction.options.getInteger("amount")!
const channel2 = interaction.channel!
const channel = interaction.channel as TextChannel
const embedColor = Number(color.replace("#", "0x"))
if (!amount || amount < 1 || amount > 100) {
@@ -45,20 +44,6 @@ export = {
})
}
if (channel2.type !== ChannelType.GuildText) {
await interaction.editReply({
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)