feat: Guild Forum channel
https://github.com/discordjs/discord.js/pull/8651
This commit is contained in:
@@ -11,6 +11,8 @@ let TextChannel;
|
||||
let ThreadChannel;
|
||||
let VoiceChannel;
|
||||
let DirectoryChannel;
|
||||
let ForumChannel;
|
||||
const ChannelFlags = require('../util/ChannelFlags');
|
||||
const { ChannelTypes, ThreadChannelTypes, VoiceBasedChannelTypes } = require('../util/Constants');
|
||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||
// Const { ApplicationCommand } = require('discord.js-selfbot-v13'); - Not being used in this file, not necessary.
|
||||
@@ -48,6 +50,17 @@ class Channel extends Base {
|
||||
* @type {Snowflake}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
if ('flags' in data) {
|
||||
/**
|
||||
* The flags that are applied to the channel.
|
||||
* <info>This is only `null` in a {@link PartialGroupDMChannel}. In all other cases, it is not `null`.</info>
|
||||
* @type {?Readonly<ChannelFlags>}
|
||||
*/
|
||||
this.flags = new ChannelFlags(data.flags).freeze();
|
||||
} else {
|
||||
this.flags ??= new ChannelFlags().freeze();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,6 +197,7 @@ class Channel extends Base {
|
||||
ThreadChannel ??= require('./ThreadChannel');
|
||||
VoiceChannel ??= require('./VoiceChannel');
|
||||
DirectoryChannel ??= require('./DirectoryChannel');
|
||||
ForumChannel ??= require('./ForumChannel');
|
||||
|
||||
let channel;
|
||||
if (!data.guild_id && !guild) {
|
||||
@@ -232,6 +246,9 @@ class Channel extends Base {
|
||||
case ChannelTypes.GUILD_DIRECTORY:
|
||||
channel = new DirectoryChannel(client, data);
|
||||
break;
|
||||
case ChannelTypes.GUILD_FORUM:
|
||||
channel = new ForumChannel(guild, data, client);
|
||||
break;
|
||||
}
|
||||
if (channel && !allowUnknownGuild) guild.channels?.cache.set(channel.id, channel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user