Skip to content

Commit 17c107d

Browse files
fix: use the quoifeurbot in public thread of allowed channels (#73)
Co-authored-by: LazyRabbit <[email protected]>
1 parent ceb5709 commit 17c107d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/modules/quoiFeur/quoiFeur.helpers.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ 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+
const messageParentId =
34+
message.channel.type === ChannelType.PublicThread ? message.channel.parentId : null;
35+
36+
const isMessageInQuoiFeurChannel =
37+
channelIds.includes(message.channelId) ||
38+
(messageParentId && channelIds.includes(messageParentId));
39+
40+
if (!isMessageInQuoiFeurChannel) return;
3441

3542
const probability = 1 / 6;
3643

0 commit comments

Comments
 (0)