Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,16 @@ declare namespace Eris {
category_id: number;
}

interface WelcomeChannel {
channelID: string;
description: string;
emojiID: string;
emojiName: string;
}
interface WelcomeScreen {
description: string;
welcomeChannels: WelcomeChannel[];
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to go in its relevant interface group a little while up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to belong here though. This is a Guild interface isn't it?

export class Guild extends Base {
afkChannelID: string | null;
afkTimeout: number;
Expand Down Expand Up @@ -1776,7 +1786,8 @@ declare namespace Eris {
verificationLevel: number;
voiceStates: Collection<VoiceState>;
widgetChannelID?: string | null;
widgetEnabled?: boolean | null;
widgetEnabled?: boolean | null;
welcomeScreen?: WelcomeScreen;
constructor(data: BaseData, client: Client);
addDiscoverySubcategory(categoryID: string, reason?: string): Promise<DiscoverySubcategoryResponse>;
addMemberRole(memberID: string, roleID: string, reason?: string): Promise<void>;
Expand Down
16 changes: 16 additions & 0 deletions lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ const {Permissions} = require("../Constants");
* @prop {Collection<VoiceState>} voiceStates Collection of voice states in the guild
* @prop {Number?} widgetChannelID The channel id that the widget will generate an invite to. REST only.
* @prop {Boolean?} widgetEnabled Whether the guild widget is enabled. REST only.
* @prop {Object?} guild.welcomeScreen The welcome screen of a Community guild, shown to new members
* @prop {Object} guild.welcomeScreen.description The description in the welcome screen
* @prop {Array<Object>} guild.welcomeScreen.welcomeChannels The list of channels in the welcome screens. Each channels have the following properties: `channelID`, `description`, `emojiID`, `emojiName`. Theses properties can be null.
*/
class Guild extends Base {
constructor(data, client) {
Expand Down Expand Up @@ -261,6 +264,19 @@ class Guild extends Base {
if(data.max_video_channel_users !== undefined) {
this.maxVideoChannelUsers = data.max_video_channel_users;
}
if(data.guild.welcome_screen !== undefined) {
this.welcomeScreen = {
description: data.guild.welcome_screen.description,
welcomeChannels: data.guild.welcome_screen.welcome_channels && data.guild.welcome_screen.welcome_channels.map((c) => {
return {
channelID: c.channel,
description: c.description,
emojiID: c.emoji_id,
emojiName: c.emoji_name
};
})
};
}
}

get bannerURL() {
Expand Down