From 407500bf52c932fc184ec558df637d929dd417f5 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Fri, 4 Aug 2017 03:44:35 -0500 Subject: [PATCH] deprecate Guild#defaultChannel (#1752) --- .npmrc | 1 + src/structures/Guild.js | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000000..579e0e4d91f9 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-json=false diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 8b0544d8e4d7..b801ff6d96f8 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -1,3 +1,4 @@ +const util = require('util'); const Long = require('long'); const User = require('./User'); const Role = require('./Role'); @@ -291,15 +292,6 @@ class Guild { return this.client.voice.connections.get(this.id) || null; } - /** - * The `#general` TextChannel of the guild - * @type {TextChannel} - * @readonly - */ - get defaultChannel() { - return this.channels.get(this.id); - } - /** * The position of this guild * This is only available when using a user account. @@ -1093,4 +1085,16 @@ class Guild { } } +/** + * The `#general` TextChannel of the guild + * @name Guild#defaultChannel + * @type {TextChannel} + * @readonly + */ +Object.defineProperty(Guild.prototype, 'defaultChannel', { + get: util.deprecate(function defaultChannel() { + return this.channels.get(this.id); + }, 'Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.'), +}); + module.exports = Guild;