Skip to content

Commit 9a89483

Browse files
authored
Expose welcomeScreen on Invite (#1037)
1 parent ccc084e commit 9a89483

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

index.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,16 @@ declare namespace Eris {
634634
computePruneCount?: boolean;
635635
reason?: string;
636636
}
637+
interface WelcomeChannel {
638+
channelID: string;
639+
description: string;
640+
emojiID: string | null;
641+
emojiName: string | null;
642+
}
643+
interface WelcomeScreen {
644+
description: string;
645+
welcomeChannels: WelcomeChannel[];
646+
}
637647
interface VoiceRegion {
638648
custom: boolean;
639649
deprecated: boolean;
@@ -1197,7 +1207,6 @@ declare namespace Eris {
11971207
theme: string;
11981208
}
11991209

1200-
12011210
class Base implements SimpleJSON {
12021211
createdAt: number;
12031212
id: string;
@@ -1783,8 +1792,10 @@ declare namespace Eris {
17831792
vanityURL: string | null;
17841793
verificationLevel: number;
17851794
voiceStates: Collection<VoiceState>;
1795+
welcomeScreen?: WelcomeScreen;
17861796
widgetChannelID?: string | null;
17871797
widgetEnabled?: boolean | null;
1798+
17881799
constructor(data: BaseData, client: Client);
17891800
addDiscoverySubcategory(categoryID: string, reason?: string): Promise<DiscoverySubcategoryResponse>;
17901801
addMemberRole(memberID: string, roleID: string, reason?: string): Promise<void>;

lib/structures/Guild.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ const {Permissions} = require("../Constants");
6464
* @prop {String?} vanityURL The vanity URL of the guild (VIP only)
6565
* @prop {Number} verificationLevel The guild verification level
6666
* @prop {Collection<VoiceState>} voiceStates Collection of voice states in the guild
67+
* @prop {Object?} welcomeScreen The welcome screen of a Community guild, shown to new members
68+
* @prop {Object} welcomeScreen.description The description in the welcome screen
69+
* @prop {Array<Object>} welcomeScreen.welcomeChannels The list of channels in the welcome screens. Each channels have the following properties: `channelID`, `description`, `emojiID`, `emojiName`. `emojiID` and `emojiName` properties can be null.
6770
* @prop {Number?} widgetChannelID The channel id that the widget will generate an invite to. REST only.
6871
* @prop {Boolean?} widgetEnabled Whether the guild widget is enabled. REST only.
6972
*/
@@ -261,6 +264,19 @@ class Guild extends Base {
261264
if(data.max_video_channel_users !== undefined) {
262265
this.maxVideoChannelUsers = data.max_video_channel_users;
263266
}
267+
if(data.guild.welcome_screen !== undefined) {
268+
this.welcomeScreen = {
269+
description: data.guild.welcome_screen.description,
270+
welcomeChannels: data.guild.welcome_screen.welcome_channels && data.guild.welcome_screen.welcome_channels.map((c) => {
271+
return {
272+
channelID: c.channel,
273+
description: c.description,
274+
emojiID: c.emoji_id,
275+
emojiName: c.emoji_name
276+
};
277+
})
278+
};
279+
}
264280
}
265281

266282
get bannerURL() {

0 commit comments

Comments
 (0)