feat: Support thread channel

This commit is contained in:
2024-03-05 14:30:43 +07:00
parent ecbf17a493
commit 466aaa60ce
+16 -3
View File
@@ -10,7 +10,8 @@ import {
TextBasedChannelMixin, TextBasedChannelMixin,
ChannelType, ChannelType,
BaseGuildVoiceChannel, BaseGuildVoiceChannel,
InteractionType InteractionType,
ThreadChannel
} from 'discord.js'; } from 'discord.js';
import Logger from '../libs/Logger'; import Logger from '../libs/Logger';
@@ -217,7 +218,13 @@ class Discord {
// Handling guild commands // Handling guild commands
this.client.on('messageCreate', async (message: Message) => { 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; return;
if (message.author.bot) return; if (message.author.bot) return;
if (typeof message.guild?.id === 'undefined') return; if (typeof message.guild?.id === 'undefined') return;
@@ -324,7 +331,13 @@ class Discord {
// Handling mentions // Handling mentions
this.client.on('messageCreate', async (message: Message) => { this.client.on('messageCreate', async (message: Message) => {
// TODO: Handle DMs commands soon // 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; return;
if (message.author.bot) return; if (message.author.bot) return;