Skip to content

Commit

Permalink
types: update references
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Aug 14, 2023
1 parent 09d981b commit 86cc43d
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 33 deletions.
4 changes: 2 additions & 2 deletions packages/discord.js/src/client/actions/WebhooksUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class WebhooksUpdate extends Action {
/**
* Emitted whenever a channel has its webhooks changed.
* @event Client#webhooksUpdate
* @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel} channel
* @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel} channel
* The channel that had a webhook update
*/
client.emit('webhooksUpdate', channel);

/**
* Emitted whenever a channel has its webhooks changed.
* @event Client#webhookUpdate
* @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel} channel
* @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel} channel
* The channel that had a webhook update
* @deprecated Use {@link Client#event:webhooksUpdate} instead.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/managers/GuildChannelManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class GuildChannelManager extends CachedManager {

/**
* @typedef {ChannelWebhookCreateOptions} WebhookCreateOptions
* @property {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|Snowflake} channel
* @property {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel|Snowflake} channel
* The channel to create the webhook for
*/

Expand Down
3 changes: 2 additions & 1 deletion packages/discord.js/src/managers/GuildInviteManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ class GuildInviteManager extends CachedManager {
* * VoiceChannel
* * NewsChannel
* * StageChannel
* * MediaChannel
* * Snowflake
* @typedef {TextChannel|VoiceChannel|NewsChannel|StageChannel|Snowflake}
* @typedef {TextChannel|VoiceChannel|NewsChannel|StageChannel|MediaChannel|Snowflake}
* GuildInvitableChannelResolvable
*/

Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/managers/ThreadManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ThreadManager extends CachedManager {

/**
* The channel this Manager belongs to
* @type {TextChannel|NewsChannel|ForumChannel}
* @type {TextChannel|NewsChannel|ForumChannel|MediaChannel}
*/
this.channel = channel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AutoModerationActionExecution {

/**
* The channel where this action was triggered from.
* @type {?(GuildTextBasedChannel|ForumChannel)}
* @type {?(GuildTextBasedChannel|ForumChannel|MediaChannel)}
* @readonly
*/
get channel() {
Expand Down
10 changes: 6 additions & 4 deletions packages/discord.js/src/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class Guild extends AnonymousGuild {

/**
* Widget channel for this guild
* @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel)}
* @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)}
* @readonly
*/
get widgetChannel() {
Expand Down Expand Up @@ -693,14 +693,15 @@ class Guild extends AnonymousGuild {
* Data for the Guild Widget Settings object
* @typedef {Object} GuildWidgetSettings
* @property {boolean} enabled Whether the widget is enabled
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel)} channel The widget invite channel
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)} channel
* The widget invite channel
*/

/**
* The Guild Widget Settings object
* @typedef {Object} GuildWidgetSettingsData
* @property {boolean} enabled Whether the widget is enabled
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|Snowflake)} channel
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel|Snowflake)} channel
* The widget invite channel
*/

Expand Down Expand Up @@ -875,7 +876,8 @@ class Guild extends AnonymousGuild {
* Welcome channel data
* @typedef {Object} WelcomeChannelData
* @property {string} description The description to show for this welcome channel
* @property {TextChannel|NewsChannel|ForumChannel|Snowflake} channel The channel to link for this welcome channel
* @property {TextChannel|NewsChannel|ForumChannel|MediaChannel|Snowflake} channel
* The channel to link for this welcome channel
* @property {EmojiIdentifierResolvable} [emoji] The emoji to display for this welcome channel
*/

Expand Down
1 change: 1 addition & 0 deletions packages/discord.js/src/structures/GuildChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const { getSortableGroupTypes } = require('../util/Util');
* - {@link NewsChannel}
* - {@link StageChannel}
* - {@link ForumChannel}
* - {@link MediaChannel}
* @extends {BaseChannel}
* @abstract
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/structures/ThreadChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class ThreadChannel extends BaseChannel {

/**
* The parent channel of this thread
* @type {?(NewsChannel|TextChannel|ForumChannel)}
* @type {?(NewsChannel|TextChannel|ForumChannel|MediaChannel)}
* @readonly
*/
get parent() {
Expand Down
4 changes: 2 additions & 2 deletions packages/discord.js/src/structures/Webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Webhook {

/**
* The channel the webhook belongs to
* @type {?(TextChannel|VoiceChannel|StageChannel|NewsChannel|ForumChannel)}
* @type {?(TextChannel|VoiceChannel|StageChannel|NewsChannel|ForumChannel|MediaChannel)}
* @readonly
*/
get channel() {
Expand Down Expand Up @@ -264,7 +264,7 @@ class Webhook {
* @typedef {Object} WebhookEditOptions
* @property {string} [name=this.name] The new name for the webhook
* @property {?(BufferResolvable)} [avatar] The new avatar for the webhook
* @property {GuildTextChannelResolvable} [channel] The new channel for the webhook
* @property {GuildTextChannelResolvable|MediaChannel} [channel] The new channel for the webhook
* @property {string} [reason] Reason for editing the webhook
*/

Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/structures/WelcomeChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WelcomeChannel extends Base {

/**
* The channel of this welcome channel
* @type {?(TextChannel|NewsChannel|ForumChannel)}
* @type {?(TextChannel|NewsChannel|ForumChannel|MediaChannel)}
*/
get channel() {
return this.client.channels.resolve(this.channelId);
Expand Down
48 changes: 29 additions & 19 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export class AutoModerationActionExecution {
public ruleTriggerType: AutoModerationRuleTriggerType;
public get user(): User | null;
public userId: Snowflake;
public get channel(): GuildTextBasedChannel | ForumChannel | null;
public get channel(): GuildTextBasedChannel | ForumChannel | MediaChannel | null;
public channelId: Snowflake | null;
public get member(): GuildMember | null;
public messageId: Snowflake | null;
Expand Down Expand Up @@ -1359,7 +1359,7 @@ export class Guild extends AnonymousGuild {
public vanityURLUses: number | null;
public get voiceAdapterCreator(): InternalDiscordGatewayAdapterCreator;
public voiceStates: VoiceStateManager;
public get widgetChannel(): TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | null;
public get widgetChannel(): TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | null;
public widgetChannelId: Snowflake | null;
public widgetEnabled: boolean | null;
public get maximumBitrate(): number;
Expand Down Expand Up @@ -3028,7 +3028,7 @@ export interface PrivateThreadChannel extends ThreadChannel<false> {
type: ChannelType.PrivateThread;
}

export class ThreadChannel<Forum extends boolean = boolean> extends TextBasedChannelMixin(BaseChannel, true, [
export class ThreadChannel<ThreadOnly extends boolean = boolean> extends TextBasedChannelMixin(BaseChannel, true, [
'fetchWebhooks',
'createWebhook',
'setNSFW',
Expand Down Expand Up @@ -3060,7 +3060,7 @@ export class ThreadChannel<Forum extends boolean = boolean> extends TextBasedCha
public members: ThreadMemberManager;
public name: string;
public ownerId: Snowflake | null;
public get parent(): If<Forum, ForumChannel, TextChannel | NewsChannel> | null;
public get parent(): If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | NewsChannel> | null;
public parentId: Snowflake | null;
public rateLimitPerUser: number | null;
public type: ThreadChannelType;
Expand Down Expand Up @@ -3346,7 +3346,7 @@ export class Webhook extends WebhookMixin() {
public token: string | null;
public type: WebhookType;
public applicationId: Snowflake | null;
public get channel(): TextChannel | VoiceChannel | NewsChannel | ForumChannel | StageChannel | null;
public get channel(): TextChannel | VoiceChannel | NewsChannel | ForumChannel | MediaChannel | StageChannel | null;
public isUserCreated(): this is this & {
type: WebhookType.Incoming;
applicationId: null;
Expand Down Expand Up @@ -3490,7 +3490,7 @@ export class WelcomeChannel extends Base {
public channelId: Snowflake;
public guild: Guild | InviteGuild;
public description: string;
public get channel(): TextChannel | NewsChannel | ForumChannel | null;
public get channel(): TextChannel | NewsChannel | ForumChannel | MediaChannel | null;
public get emoji(): GuildEmoji | Emoji;
}

Expand Down Expand Up @@ -4187,13 +4187,16 @@ export class StageInstanceManager extends CachedManager<Snowflake, StageInstance
public delete(channel: StageChannelResolvable): Promise<void>;
}

export class ThreadManager<Forum extends boolean = boolean> extends CachedManager<
export class ThreadManager<ThreadOnly extends boolean = boolean> extends CachedManager<
Snowflake,
ThreadChannel<Forum>,
ThreadChannel<ThreadOnly>,
ThreadChannelResolvable
> {
protected constructor(channel: TextChannel | NewsChannel | ForumChannel, iterable?: Iterable<RawThreadChannelData>);
public channel: If<Forum, ForumChannel, TextChannel | NewsChannel>;
protected constructor(
channel: TextChannel | NewsChannel | ForumChannel | MediaChannel,
iterable?: Iterable<RawThreadChannelData>,
);
public channel: If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | NewsChannel>;
public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<AnyThreadChannel | null>;
public fetch(
options: FetchThreadsOptions & { archived: FetchArchivedThreadOptions },
Expand Down Expand Up @@ -4827,7 +4830,7 @@ export interface ChannelWebhookCreateOptions {
}

export interface WebhookCreateOptions extends ChannelWebhookCreateOptions {
channel: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | Snowflake;
channel: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannel | Snowflake;
}

export interface ClientEvents {
Expand Down Expand Up @@ -4905,7 +4908,7 @@ export interface ClientEvents {
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
/** @deprecated Use {@link webhooksUpdate} instead. */
webhookUpdate: ClientEvents['webhooksUpdate'];
webhooksUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel];
webhooksUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | MediaChannel];
interactionCreate: [interaction: Interaction];
shardDisconnect: [closeEvent: CloseEvent, shardId: number];
shardError: [error: Error, shardId: number];
Expand Down Expand Up @@ -5588,7 +5591,7 @@ export interface GuildCreateOptions {

export interface GuildWidgetSettings {
enabled: boolean;
channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | null;
channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | null;
}

export interface GuildEditOptions {
Expand Down Expand Up @@ -5668,7 +5671,7 @@ export interface GuildPruneMembersOptions {

export interface GuildWidgetSettingsData {
enabled: boolean;
channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | Snowflake | null;
channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | Snowflake | null;
}

export interface GuildSearchMembersOptions {
Expand Down Expand Up @@ -5808,7 +5811,13 @@ export interface InviteGenerationOptions {
scopes: OAuth2Scopes[];
}

export type GuildInvitableChannelResolvable = TextChannel | VoiceChannel | NewsChannel | StageChannel | Snowflake;
export type GuildInvitableChannelResolvable =
| TextChannel
| VoiceChannel
| NewsChannel
| StageChannel
| MediaChannel
| Snowflake;

export interface InviteCreateOptions {
temporary?: boolean;
Expand Down Expand Up @@ -6323,11 +6332,12 @@ export type Channel =
| TextChannel
| AnyThreadChannel
| VoiceChannel
| ForumChannel;
| ForumChannel
| MediaChannel;

export type TextBasedChannel = Exclude<
Extract<Channel, { type: TextChannelType }>,
PartialGroupDMChannel | ForumChannel
PartialGroupDMChannel | ForumChannel | MediaChannel
>;

export type TextBasedChannelTypes = TextBasedChannel['type'];
Expand Down Expand Up @@ -6411,7 +6421,7 @@ export type WebhookClientOptions = Pick<ClientOptions, 'allowedMentions' | 'rest
export interface WebhookEditOptions {
name?: string;
avatar?: BufferResolvable | null;
channel?: GuildTextChannelResolvable | VoiceChannel | ForumChannel | StageChannel;
channel?: GuildTextChannelResolvable | VoiceChannel | StageChannel | ForumChannel | MediaChannel;
reason?: string;
}

Expand Down Expand Up @@ -6453,7 +6463,7 @@ export interface WidgetChannel {

export interface WelcomeChannelData {
description: string;
channel: TextChannel | NewsChannel | ForumChannel | Snowflake;
channel: TextChannel | NewsChannel | ForumChannel | MediaChannel | Snowflake;
emoji?: EmojiIdentifierResolvable;
}

Expand Down

0 comments on commit 86cc43d

Please sign in to comment.