Add user_guild_settings support (#1365)

* user guild settings

* Use direct collection

* I'm a goof

* double goof

* Structure properties

* Forgot to register listener

* wrong class names

* No more get in docs

* avoid waterfalls, bot checks

* trycatch

wow i thought i already did this :notlikecat:

* 👀

* Update ClientUser.js

* Update ClientUserGuildSettings.js

* Update UserGuildSettingsUpdate.js

* Update ClientUserChannelOverride.js

* Update ClientUserGuildSettings.js
This commit is contained in:
stupid cat
2017-07-31 20:28:15 -06:00
committed by Crawl
parent 4f5d1bffaf
commit b8034525e3
9 changed files with 259 additions and 0 deletions

View File

@@ -333,6 +333,62 @@ class Guild {
}
/**
* Whether the guild is muted
* <warn>This is only available when using a user account.</warn>
* @type {?boolean}
*/
get muted() {
if (this.client.user.bot) return null;
try {
return this.client.user.guildSettings.get(this.id).muted;
} catch (err) {
return false;
}
}
/**
* The type of message that should notify you
* one of `EVERYTHING`, `MENTIONS`, `NOTHING`
* <warn>This is only available when using a user account.</warn>
* @type {string}
*/
get messageNotifications() {
if (this.client.user.bot) return null;
try {
return this.client.user.guildSettings.get(this.id).messageNotifications;
} catch (err) {
return null;
}
}
/**
* Whether to receive mobile push notifications
* <warn>This is only available when using a user account.</warn>
* @type {boolean}
*/
get mobilePush() {
if (this.client.user.bot) return null;
try {
return this.client.user.guildSettings.get(this.id).mobilePush;
} catch (err) {
return false;
}
}
/**
* Whether to suppress everyone messages
* <warn>This is only available when using a user account.</warn>
* @type {boolean}
*/
get suppressEveryone() {
try {
return this.client.user.guildSettings.get(this.id).suppressEveryone;
} catch (err) {
return null;
}
}
/*
* The `@everyone` role of the guild
* @type {Role}
* @readonly