feat(Role): role tags (#4628)

* feat(Role): role tags

* fix(RoleManager): fix js docs and mark nullable

* fix(Role): typings tags are be null, not undefined

* fix(Role): getters should actually return a bool

* fix(RoleManager): typo

* fix(Role): should always return a boolean

* fix(Gmrm): getter should return null

* fix(RoleManager): getters should return null

* fix: typing getters should return null

* fix(Role): docs grammar and consistency

* chore: prefer in operator over Reflect#has

* feat(GmRm): botRole getter

* fix(GmRm): use the actual properties

* feat(RoleManager): rem myRole in pref o botRoleFor

* fix(Role): remove obsolete is- getters

* fix:  checking tags after getter removal

* chore: identifier naming consistency

* chore: prefer explicit true type over boolean

* fix: typo

* feat(Integration): Add Integration#roles getter (#1)

* fix(RoleManager): remove bot check r:partials

* feat(RoleManager): robustness against uncached u

* docs: possibly undefined

Co-authored-by: Jan <66554238+Vaporox@users.noreply.github.com>
This commit is contained in:
Souji
2020-12-14 13:54:02 +01:00
committed by GitHub
parent 8883a0144b
commit d6234b764e
5 changed files with 83 additions and 1 deletions

View File

@@ -82,6 +82,26 @@ class Role extends Base {
* @type {boolean}
*/
this.deleted = false;
/**
* The tags this role has
* @type {?Object}
* @property {Snowflake} [botID] The id of the bot this role belongs to
* @property {Snowflake} [integrationID] The id of the integration this role belongs to
* @property {true} [premiumSubscriberRole] Whether this is the guild's premium subscription role
*/
this.tags = data.tags ? {} : null;
if (data.tags) {
if ('bot_id' in data.tags) {
this.tags.botID = data.tags.bot_id;
}
if ('integration_id' in data.tags) {
this.tags.integrationID = data.tags.integration_id;
}
if ('premium_subscriber' in data.tags) {
this.tags.premiumSubscriberRole = true;
}
}
}
/**