feat(StageChannel): v13 support messages (#9145)

Co-authored-by: kyranet <kyradiscord@gmail.com>
This commit is contained in:
Jaw0r3k
2023-04-14 23:32:58 +02:00
committed by GitHub
parent add14acc20
commit 7cf9224c46
8 changed files with 217 additions and 148 deletions

26
typings/index.d.ts vendored
View File

@@ -479,17 +479,23 @@ export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
public setType(type: Pick<typeof ChannelTypes, 'GUILD_NEWS'>, reason?: string): Promise<NewsChannel>;
}
export class BaseGuildVoiceChannel extends GuildChannel {
export class BaseGuildVoiceChannel extends TextBasedChannelMixin(GuildChannel, ['lastPinTimestamp', 'lastPinAt']) {
public constructor(guild: Guild, data?: RawGuildChannelData);
public readonly members: Collection<Snowflake, GuildMember>;
public readonly full: boolean;
public readonly joinable: boolean;
public rtcRegion: string | null;
public bitrate: number;
public nsfw: boolean;
public rtcRegion: string | null;
public rateLimitPerUser: number | null;
public userLimit: number;
public videoQualityMode: VideoQualityMode | null;
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
public setRTCRegion(rtcRegion: string | null, reason?: string): Promise<this>;
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
public setVideoQualityMode(videoQualityMode: VideoQualityMode | number, reason?: string): Promise<VoiceChannel>;
}
export class BaseMessageComponent {
@@ -2321,9 +2327,9 @@ export class SnowflakeUtil extends null {
}
export class StageChannel extends BaseGuildVoiceChannel {
public readonly stageInstance: StageInstance | null;
public topic: string | null;
public type: 'GUILD_STAGE_VOICE';
public readonly stageInstance: StageInstance | null;
public createStageInstance(options: StageInstanceCreateOptions): Promise<StageInstance>;
public setTopic(topic: string): Promise<StageChannel>;
}
@@ -2799,17 +2805,11 @@ export class Formatters extends null {
public static userMention: typeof userMention;
}
export class VoiceChannel extends TextBasedChannelMixin(BaseGuildVoiceChannel, ['lastPinTimestamp', 'lastPinAt']) {
public videoQualityMode: VideoQualityMode | null;
export class VoiceChannel extends BaseGuildVoiceChannel {
/** @deprecated Use manageable instead */
public readonly editable: boolean;
public readonly speakable: boolean;
public type: 'GUILD_VOICE';
public nsfw: boolean;
public rateLimitPerUser: number | null;
public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
public setVideoQualityMode(videoQualityMode: VideoQualityMode | number, reason?: string): Promise<VoiceChannel>;
}
export class VoiceRegion {
@@ -3365,7 +3365,7 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
public createWebhook(
channel: GuildChannelResolvable,
name: string,
options?: TextChannel | NewsChannel | VoiceChannel | Snowflake,
options?: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | Snowflake,
): Promise<Webhook>;
public addFollower(
channel: NewsChannel | Snowflake,
@@ -4575,7 +4575,7 @@ export interface ClientEvents extends BaseClientEvents {
typingStart: [typing: Typing];
userUpdate: [oldUser: User | PartialUser, newUser: User];
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel];
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | StageChannel];
/** @deprecated Use interactionCreate instead */
interaction: [interaction: Interaction];
interactionCreate: [interaction: Interaction];
@@ -6437,7 +6437,7 @@ export type WebhookClientOptions = Pick<
export interface WebhookEditData {
name?: string;
avatar?: BufferResolvable | null;
channel?: GuildTextChannelResolvable;
channel?: GuildTextChannelResolvable | VoiceChannel | StageChannel | ForumChannel;
}
export type WebhookEditMessageOptions = Pick<

View File

@@ -1323,7 +1323,7 @@ declare const GuildBasedChannel: GuildBasedChannel;
declare const NonThreadGuildBasedChannel: NonThreadGuildBasedChannel;
declare const GuildTextBasedChannel: GuildTextBasedChannel;
expectType<DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(TextBasedChannel);
expectType<DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel | VoiceChannel | StageChannel>(TextBasedChannel);
expectType<
| 'DM'
| 'GUILD_NEWS'
@@ -1332,6 +1332,7 @@ expectType<
| 'GUILD_PRIVATE_THREAD'
| 'GUILD_NEWS_THREAD'
| 'GUILD_VOICE'
| 'GUILD_STAGE_VOICE'
>(TextBasedChannelTypes);
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | ThreadChannel | VoiceChannel | ForumChannel>(
@@ -1340,4 +1341,4 @@ expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextCha
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | VoiceChannel | ForumChannel>(
NonThreadGuildBasedChannel,
);
expectType<NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(GuildTextBasedChannel);
expectType<NewsChannel | TextChannel | ThreadChannel | VoiceChannel | StageChannel>(GuildTextBasedChannel);