From a9e1d000b1e9156e7ac189c59379178777e24ac3 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Tue, 12 Aug 2025 02:39:24 +0300 Subject: [PATCH 1/2] fix: add current repel channel --- src/v2/commands/repel/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/v2/commands/repel/index.ts b/src/v2/commands/repel/index.ts index a80231c0..0c8f7628 100644 --- a/src/v2/commands/repel/index.ts +++ b/src/v2/commands/repel/index.ts @@ -98,8 +98,8 @@ const getTargetFromInteraction = async ( return target; }; -const getTextChannels = (guild: Guild) => { - return guild.channels.cache +const getTextChannels = (interaction: ChatInputCommandInteraction) => { + const channels = interaction.guild.channels.cache .filter( (ch): ch is TextChannel => !IGNORED_CHANNEL_CATEGORIES.includes(ch.parentId) && @@ -107,6 +107,7 @@ const getTextChannels = (guild: Guild) => { Boolean(ch.lastMessageId), ) .values(); + return [interaction.channel as TextChannel, ...channels]; }; const checkPermission = async ({ @@ -465,7 +466,7 @@ export const repelInteraction: CommandDataWithHandler = { RepelCommandOptions.DELETE_COUNT, false, ) ?? REPEL_DEFAULT_DELETE_COUNT; - const channels = getTextChannels(interaction.guild); + const channels = getTextChannels(interaction); const deleted = await handleDeleteMessages({ channels, count, From cb8417c4fdd01ee04876964e3a157aa4ea88a934 Mon Sep 17 00:00:00 2001 From: Cake Date: Tue, 12 Aug 2025 02:43:23 +0300 Subject: [PATCH 2/2] Update index.ts --- src/v2/commands/repel/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/v2/commands/repel/index.ts b/src/v2/commands/repel/index.ts index 0c8f7628..c7a711a5 100644 --- a/src/v2/commands/repel/index.ts +++ b/src/v2/commands/repel/index.ts @@ -104,6 +104,7 @@ const getTextChannels = (interaction: ChatInputCommandInteraction) => { (ch): ch is TextChannel => !IGNORED_CHANNEL_CATEGORIES.includes(ch.parentId) && ch.type === ChannelType.GuildText && + interaction.channelId !== ch.id && Boolean(ch.lastMessageId), ) .values();