fix: Miscellaneous fixes

#9445 djs
This commit is contained in:
Elysia
2023-05-02 11:34:13 +07:00
parent fbaf7ed7c8
commit f4dbc57f42
16 changed files with 45 additions and 27 deletions

View File

@@ -7,6 +7,19 @@ const GuildChannel = require('./GuildChannel');
* @extends {GuildChannel}
*/
class CategoryChannel extends GuildChannel {
/**
* The id of the parent of this channel.
* @name CategoryChannel#parentId
* @type {null}
*/
/**
* The parent of this channel.
* @name CategoryChannel#parent
* @type {null}
* @readonly
*/
/**
* Channels that are a part of this category
* @type {Collection<Snowflake, GuildChannel>}
@@ -18,7 +31,7 @@ class CategoryChannel extends GuildChannel {
/**
* Sets the category parent of this channel.
* <warn>It is not currently possible to set the parent of a CategoryChannel.</warn>
* <warn>It is not possible to set the parent of a CategoryChannel.</warn>
* @method setParent
* @memberof CategoryChannel
* @instance

View File

@@ -186,7 +186,7 @@ class Channel extends Base {
return this.type === 'GUILD_DIRECTORY';
}
static create(client, data, guild, { allowUnknownGuild, fromInteraction } = {}) {
static create(client, data, guild, { allowUnknownGuild } = {}) {
CategoryChannel ??= require('./CategoryChannel');
DMChannel ??= require('./DMChannel');
NewsChannel ??= require('./NewsChannel');
@@ -238,7 +238,7 @@ class Channel extends Base {
case ChannelTypes.GUILD_NEWS_THREAD:
case ChannelTypes.GUILD_PUBLIC_THREAD:
case ChannelTypes.GUILD_PRIVATE_THREAD: {
channel = new ThreadChannel(guild, data, client, fromInteraction);
channel = new ThreadChannel(guild, data, client);
if (!allowUnknownGuild) channel.parent?.threads.cache.set(channel.id, channel);
break;
}

View File

@@ -722,7 +722,7 @@ class Message extends Base {
* @property {MessageAttachment[]} [attachments] An array of attachments to keep,
* all attachments will be kept if omitted
* @property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] Files to add to the message
* @property {MessageActionRow[]|MessageActionRowOptions[]} [components]
* @property {Array<(MessageActionRow|MessageActionRowOptions)>} [components]
* Action rows containing interactive components for the message (buttons, select menus)
*/

View File

@@ -14,7 +14,7 @@ class Modal {
* @typedef {Object} ModalOptions
* @property {string} [customId] A unique string to be sent in the interaction when clicked
* @property {string} [title] The title to be displayed on this modal
* @property {MessageActionRow[]|MessageActionRowOptions[]} [components]
* @property {Array<(MessageActionRow|MessageActionRowOptions)>} [components]
* Action rows containing interactive components for the modal (text input components)
*/

View File

@@ -16,7 +16,7 @@ const { resolveAutoArchiveMaxLimit } = require('../util/Util');
* @implements {TextBasedChannel}
*/
class ThreadChannel extends Channel {
constructor(guild, data, client, fromInteraction = false) {
constructor(guild, data, client) {
super(guild?.client ?? client, data, false);
/**
@@ -48,7 +48,7 @@ class ThreadChannel extends Channel {
* @type {InteractionManager}
*/
this.interactions = new InteractionManager(this);
if (data) this._patch(data, fromInteraction);
if (data) this._patch(data);
}
/**

View File

@@ -127,7 +127,7 @@ class Webhook {
* @property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] See {@link BaseMessageOptions#files}
* @property {MessageMentionOptions} [allowedMentions] See {@link BaseMessageOptions#allowedMentions}
* @property {MessageAttachment[]} [attachments] Attachments to send with the message
* @property {MessageActionRow[]|MessageActionRowOptions[]} [components]
* @property {Array<(MessageActionRow|MessageActionRowOptions)>} [components]
* Action rows containing interactive components for the message (buttons, select menus)
* @property {Snowflake} [threadId] The id of the thread this message belongs to
* <info>For interaction webhooks, this property is ignored</info>

View File

@@ -76,12 +76,12 @@ class TextBasedChannel {
* @property {boolean} [tts=false] Whether or not the message should be spoken aloud
* @property {string} [nonce=''] The nonce for the message
* @property {string} [content=''] The content for the message
* @property {WebEmbed[]|MessageEmbed[]|APIEmbed[]} [embeds] The embeds for the message
* @property {Array<(MessageEmbed|APIEmbed|WebEmbed)>} [embeds] The embeds for the message
* (see [here](https://discord.com/developers/docs/resources/channel#embed-object) for more details)
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
* (see [here](https://discord.com/developers/docs/resources/channel#allowed-mentions-object) for more details)
* @property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] Files to send with the message
* @property {MessageActionRow[]|MessageActionRowOptions[]} [components]
* @property {Array<(FileOptions|BufferResolvable|MessageAttachment[])>} [files] Files to send with the message
* @property {Array<(MessageActionRow|MessageActionRowOptions)>} [components]
* Action rows containing interactive components for the message (buttons, select menus)
* @property {MessageAttachment[]} [attachments] Attachments to send in the message
* @property {boolean} [usingNewAttachmentAPI] Whether to use the new attachment API (`channels/:id/attachments`)