From bea6da621d0e37000826c6fddf6f33c964704443 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 ca462381f..fc04530c9 100644
--- a/src/structures/Guild.js
+++ b/src/structures/Guild.js
@@ -320,6 +320,20 @@ class Guild extends Base {
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.channels) {
this.channels.cache.clear();
for (const rawChannel of data.channels) {
@@ -504,6 +518,26 @@ class Guild extends Base {
return this.client.channels.cache.get(this.embedChannelID) || null;
}
+ /**
+ * Rules channel for this guild
+ * This is only available on guilds with the `PUBLIC` feature
+ * @type {?TextChannel}
+ * @readonly
+ */
+ get rulesChannel() {
+ return this.client.channels.cache.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.cache.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 76a0dc93a..373ff4055 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -710,8 +710,12 @@ declare module 'discord.js' {
public premiumSubscriptionCount: number | null;
public premiumTier: PremiumTier;
public presences: PresenceManager;
+ public readonly publicUpdatesChannel: TextChannel | null;
+ public publicUpdatesChannelID: Snowflake | null;
public region: string;
public roles: RoleManager;
+ public readonly rulesChannel: TextChannel | null;
+ public rulesChannelID: Snowflake | null;
public readonly shard: WebSocketShard;
public shardID: number;
public splash: string | null;