feat: allow channels from uncached guilds to be returned from fetch (#6034)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
ckohen
2021-07-06 05:04:26 -07:00
committed by GitHub
parent 2e078e4488
commit 755c180659
9 changed files with 79 additions and 34 deletions

View File

@@ -15,9 +15,10 @@ class ThreadChannel extends Channel {
/**
* @param {Guild} guild The guild the thread channel is part of
* @param {APIChannel} data The data for the thread channel
* @param {Client} [client] A safety parameter for the client that instantiated this
*/
constructor(guild, data) {
super(guild.client, data, false);
constructor(guild, data, client) {
super(guild?.client ?? client, data, false);
/**
* The guild the thread is in
@@ -25,6 +26,12 @@ class ThreadChannel extends Channel {
*/
this.guild = guild;
/**
* The id of the guild the channel is in
* @type {Snowflake}
*/
this.guildId = guild?.id ?? data.guild_id;
/**
* A manager of the messages sent to this thread
* @type {MessageManager}
@@ -50,6 +57,10 @@ class ThreadChannel extends Channel {
*/
this.name = data.name;
if ('guild_id' in data) {
this.guildId = data.guild_id;
}
if ('parent_id' in data) {
/**
* The id of the parent channel of this thread