From b0aed050e3516d28fb05b71b65a88078b4816f91 Mon Sep 17 00:00:00 2001 From: Sugden <28943913+NotSugden@users.noreply.github.com> Date: Sat, 22 Feb 2020 12:04:41 +0000 Subject: [PATCH] feat(Guild): add rulesChannel and publicUpdatesChannel (#3810) * add rulesChannel* & publicUpdatesChannel* * update typings --- src/structures/Guild.js | 34 ++++++++++++++++++++++++++++++++++ typings/index.d.ts | 4 ++++ 2 files changed, 38 insertions(+) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 7ad241f89..69acfe1fb 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -275,6 +275,20 @@ class Guild { this.available = !data.unavailable; this.features = data.features || this.features || []; + /** + * The ID of the rules channel for the guild + * This is only available on guilds with the `PUBLIC` feature + * @type {?Snowflake} + */ + this.rulesChannelID = data.rules_channel_id; + + /** + * The ID of the public updates channel for the guild + * This is only available on guilds with the `PUBLIC` feature + * @type {?Snowflake} + */ + this.publicUpdatesChannelID = data.public_updates_channel_id; + if (data.members) { this.members.clear(); for (const guildUser of data.members) this._addMember(guildUser, false); @@ -558,6 +572,26 @@ class Guild { return this.roles.get(this.id); } + /** + * Rules channel for this guild + * This is only available on guilds with the `PUBLIC` feature + * @type {?TextChannel} + * @readonly + */ + get rulesChannel() { + return this.client.channels.get(this.rulesChannelID) || null; + } + + /** + * Public updates channel for this guild + * This is only available on guilds with the `PUBLIC` feature + * @type {?TextChannel} + * @readonly + */ + get publicUpdatesChannel() { + return this.client.channels.get(this.publicUpdatesChannelID) || null; + } + /** * The client user as a GuildMember of this guild * @type {?GuildMember} diff --git a/typings/index.d.ts b/typings/index.d.ts index de12e4f77..eae697b5c 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -550,8 +550,12 @@ declare module 'discord.js' { public premiumTier: PremiumTier; public readonly position: number; public presences: Collection; + public readonly publicUpdatesChannel: TextChannel | null; + public publicUpdatesChannelID: Snowflake | null; public region: string; public roles: Collection; + public readonly rulesChannel: TextChannel | null; + public rulesChannelID: Snowflake | null; public splash: string; public readonly splashURL: string; public readonly suppressEveryone: boolean;