From 466aaa60ce0f440520b7392048d0725a29307f8d Mon Sep 17 00:00:00 2001 From: Yuzu Date: Tue, 5 Mar 2024 14:30:43 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Support=20thread=20channel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/providers/Discord.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/providers/Discord.ts b/src/providers/Discord.ts index 7be5866..9082bf8 100644 --- a/src/providers/Discord.ts +++ b/src/providers/Discord.ts @@ -10,7 +10,8 @@ import { TextBasedChannelMixin, ChannelType, BaseGuildVoiceChannel, - InteractionType + InteractionType, + ThreadChannel } from 'discord.js'; import Logger from '../libs/Logger'; @@ -217,7 +218,13 @@ class Discord { // Handling guild commands this.client.on('messageCreate', async (message: Message) => { - if (!(message.channel instanceof BaseGuildTextChannel || message.channel instanceof BaseGuildVoiceChannel)) + if ( + !( + message.channel instanceof BaseGuildTextChannel || + message.channel instanceof BaseGuildVoiceChannel || + message.channel instanceof ThreadChannel + ) + ) return; if (message.author.bot) return; if (typeof message.guild?.id === 'undefined') return; @@ -324,7 +331,13 @@ class Discord { // Handling mentions this.client.on('messageCreate', async (message: Message) => { // TODO: Handle DMs commands soon - if (!(message.channel instanceof BaseGuildTextChannel || message.channel instanceof BaseGuildVoiceChannel)) + if ( + !( + message.channel instanceof BaseGuildTextChannel || + message.channel instanceof BaseGuildVoiceChannel || + message.channel instanceof ThreadChannel + ) + ) return; if (message.author.bot) return;