Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/v2/commands/repel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,17 @@ 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) &&
ch.type === ChannelType.GuildText &&
interaction.channelId !== ch.id &&
Boolean(ch.lastMessageId),
)
.values();
return [interaction.channel as TextChannel, ...channels];
};

const checkPermission = async ({
Expand Down Expand Up @@ -465,7 +467,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,
Expand Down
Loading