Skip to content

Commit a9e1d00

Browse files
committed
fix: add current repel channel
1 parent 518e9d6 commit a9e1d00

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/v2/commands/repel/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,16 @@ const getTargetFromInteraction = async (
9898
return target;
9999
};
100100

101-
const getTextChannels = (guild: Guild) => {
102-
return guild.channels.cache
101+
const getTextChannels = (interaction: ChatInputCommandInteraction) => {
102+
const channels = interaction.guild.channels.cache
103103
.filter(
104104
(ch): ch is TextChannel =>
105105
!IGNORED_CHANNEL_CATEGORIES.includes(ch.parentId) &&
106106
ch.type === ChannelType.GuildText &&
107107
Boolean(ch.lastMessageId),
108108
)
109109
.values();
110+
return [interaction.channel as TextChannel, ...channels];
110111
};
111112

112113
const checkPermission = async ({
@@ -465,7 +466,7 @@ export const repelInteraction: CommandDataWithHandler = {
465466
RepelCommandOptions.DELETE_COUNT,
466467
false,
467468
) ?? REPEL_DEFAULT_DELETE_COUNT;
468-
const channels = getTextChannels(interaction.guild);
469+
const channels = getTextChannels(interaction);
469470
const deleted = await handleDeleteMessages({
470471
channels,
471472
count,

0 commit comments

Comments
 (0)