feat(WelcomeScreen): welcome screens (#5490)

Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com>
Co-authored-by: izexi <43889168+izexi@users.noreply.github.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
Souji
2021-06-19 17:44:45 +02:00
committed by GitHub
parent 807ea2d3c1
commit 44e2ee7b20
11 changed files with 342 additions and 63 deletions

63
typings/index.d.ts vendored
View File

@@ -187,6 +187,17 @@ declare module 'discord.js' {
public static resolve(bit?: BitFieldResolvable<ActivityFlagsString, number>): number;
}
export abstract class AnonymousGuild extends BaseGuild {
public banner: string | null;
public description: string | null;
public nsfwLevel: NSFWLevel;
public splash: string | null;
public vanityURLCode: string | null;
public verificationLevel: VerificationLevel;
public bannerURL(options?: StaticImageURLOptions): string | null;
public splashURL(options?: StaticImageURLOptions): string | null;
}
export class APIMessage {
constructor(target: MessageTarget, options: MessageOptions | WebhookMessageOptions);
public data: unknown | null;
@@ -282,7 +293,7 @@ declare module 'discord.js' {
public toJSON(...props: { [key: string]: boolean | string }[]): unknown;
}
export class BaseGuild extends Base {
export abstract class BaseGuild extends Base {
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public features: GuildFeatures[];
@@ -759,7 +770,7 @@ declare module 'discord.js' {
export class Emoji extends Base {
constructor(client: Client, emoji: unknown);
public animated: boolean;
public animated: boolean | null;
public readonly createdAt: Date | null;
public readonly createdTimestamp: number | null;
public deleted: boolean;
@@ -771,7 +782,7 @@ declare module 'discord.js' {
public toString(): string;
}
export class Guild extends BaseGuild {
export class Guild extends AnonymousGuild {
constructor(client: Client, data: unknown);
private _sortedRoles(): Collection<Snowflake, Role>;
private _sortedChannels(channel: Channel): Collection<Snowflake, GuildChannel>;
@@ -783,13 +794,11 @@ declare module 'discord.js' {
public approximateMemberCount: number | null;
public approximatePresenceCount: number | null;
public available: boolean;
public banner: string | null;
public bans: GuildBanManager;
public channels: GuildChannelManager;
public commands: GuildApplicationCommandManager;
public defaultMessageNotifications: DefaultMessageNotificationLevel | number;
public deleted: boolean;
public description: string | null;
public discoverySplash: string | null;
public emojis: GuildEmojiManager;
public explicitContentFilter: ExplicitContentFilterLevel;
@@ -802,7 +811,6 @@ declare module 'discord.js' {
public memberCount: number;
public members: GuildMemberManager;
public mfaLevel: MFALevel;
public nsfwLevel: NSFWLevel;
public ownerID: Snowflake;
public preferredLocale: string;
public premiumSubscriptionCount: number | null;
@@ -815,26 +823,23 @@ declare module 'discord.js' {
public rulesChannelID: Snowflake | null;
public readonly shard: WebSocketShard;
public shardID: number;
public splash: string | null;
public stageInstances: StageInstanceManager;
public readonly systemChannel: TextChannel | null;
public systemChannelFlags: Readonly<SystemChannelFlags>;
public systemChannelID: Snowflake | null;
public vanityURLCode: string | null;
public vanityURLUses: number | null;
public verificationLevel: VerificationLevel;
public readonly voiceAdapterCreator: DiscordGatewayAdapterCreator;
public readonly voiceStates: VoiceStateManager;
public readonly widgetChannel: TextChannel | null;
public widgetChannelID: Snowflake | null;
public widgetEnabled: boolean | null;
public addMember(user: UserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>;
public bannerURL(options?: StaticImageURLOptions): string | null;
public createIntegration(data: IntegrationData, reason?: string): Promise<Guild>;
public createTemplate(name: string, description?: string): Promise<GuildTemplate>;
public delete(): Promise<Guild>;
public discoverySplashURL(options?: StaticImageURLOptions): string | null;
public edit(data: GuildEditData, reason?: string): Promise<Guild>;
public editWelcomeScreen(data: WelcomeScreenEditData): Promise<WelcomeScreen>;
public equals(guild: Guild): boolean;
public fetchAuditLogs(options?: GuildAuditLogsFetchOptions): Promise<GuildAuditLogs>;
public fetchIntegrations(): Promise<Collection<string, Integration>>;
@@ -845,6 +850,7 @@ declare module 'discord.js' {
public fetchVanityData(): Promise<Vanity>;
public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>;
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
public fetchWelcomeScreen(): Promise<WelcomeScreen>;
public fetchWidget(): Promise<GuildWidget>;
public leave(): Promise<Guild>;
public setAFKChannel(afkChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
@@ -872,7 +878,6 @@ declare module 'discord.js' {
public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: VerificationLevel | number, reason?: string): Promise<Guild>;
public setWidget(widget: GuildWidgetData, reason?: string): Promise<Guild>;
public splashURL(options?: StaticImageURLOptions): string | null;
public toJSON(): unknown;
}
@@ -1176,7 +1181,7 @@ declare module 'discord.js' {
public createdTimestamp: number | null;
public readonly expiresAt: Date | null;
public readonly expiresTimestamp: number | null;
public guild: Guild | null;
public guild: InviteGuild | Guild | null;
public inviter: User | null;
public maxAge: number | null;
public maxUses: number | null;
@@ -1207,6 +1212,11 @@ declare module 'discord.js' {
public readonly guild: Guild | null;
}
export class InviteGuild extends AnonymousGuild {
constructor(client: Client, data: unknown);
public welcomeScreen: WelcomeScreen | null;
}
export class Message extends Base {
constructor(client: Client, data: unknown, channel: TextChannel | DMChannel | NewsChannel);
private patch(data: unknown): Message;
@@ -2117,6 +2127,22 @@ declare module 'discord.js' {
public activity?: WidgetActivity;
}
export class WelcomeChannel extends Base {
private _emoji: unknown;
public channelID: Snowflake;
public guild: Guild | InviteGuild;
public description: string;
public readonly channel: TextChannel | NewsChannel | null;
public readonly emoji: GuildEmoji | Emoji;
}
export class WelcomeScreen extends Base {
public readonly enabled: boolean;
public guild: Guild | InviteGuild;
public description: string | null;
public welcomeChannels: Collection<Snowflake, WelcomeChannel>;
}
//#endregion
//#region Collections
@@ -2714,6 +2740,7 @@ declare module 'discord.js' {
position?: number;
}
type GuildTextChannelResolvable = TextChannel | NewsChannel | Snowflake;
type ChannelResolvable = Channel | Snowflake;
interface ChannelWebhookCreateOptions {
@@ -3967,6 +3994,18 @@ declare module 'discord.js' {
position: number;
}
interface WelcomeChannelData {
description: string;
channel: GuildChannelResolvable;
emoji?: EmojiIdentifierResolvable;
}
interface WelcomeScreenEditData {
enabled?: boolean;
description?: string;
welcomeChannels?: WelcomeChannelData[];
}
type WSEventType =
| 'READY'
| 'RESUMED'