Skip to content

Commit 76f5fc7

Browse files
committed
fix: use the quoifeurbot in public thread of allowed channels
1 parent 00ce6a8 commit 76f5fc7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/modules/quoiFeur/quoiFeur.helpers.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from 'discord.js';
88

99
import { cache } from '../../core/cache';
10-
import { removeEmoji, removePunctuation, removeMarkdown } from '../../helpers/regex.helper';
10+
import { removeEmoji, removeMarkdown,removePunctuation } from '../../helpers/regex.helper';
1111

1212
const ONE_MINUTE = 1 * 60 * 1000;
1313

@@ -29,8 +29,18 @@ export const reactOnEndWithQuoi = async (message: Message) => {
2929
if (!endWithQuoi(message.content)) return;
3030

3131
const channelIds = await cache.get('quoiFeurChannels', []);
32-
const channelHasGame = channelIds.find((channelId) => channelId === message.channelId);
33-
if (!channelHasGame) return;
32+
33+
let messageParentId = null;
34+
if (message.channel.type === ChannelType.PublicThread) {
35+
messageParentId = message.channel.parentId;
36+
}
37+
38+
const isMessageInQuoiFeurChannel = (
39+
channelIds.includes(message.channelId) ||
40+
(messageParentId && channelIds.includes(messageParentId))
41+
);
42+
43+
if (!isMessageInQuoiFeurChannel) return;
3444

3545
const probability = 1 / 6;
3646

0 commit comments

Comments
 (0)