feat(Guild): add support to edit defaultMessageNotifications level (#2592)

* Added support for `defaultMessageNotifications`

* Requested changes

* docs: Change type for GuildEditData.defaultMessageNotifications
This commit is contained in:
Kyra
2018-06-19 21:16:05 +02:00
committed by SpaceEEC
parent 5e011dbc11
commit 270a278a6e

View File

@@ -634,6 +634,7 @@ class Guild extends Base {
* @property {Base64Resolvable} [icon] The icon of the guild
* @property {GuildMemberResolvable} [owner] The owner of the guild
* @property {Base64Resolvable} [splash] The splash screen of the guild
* @property {DefaultMessageNotifications|number} [defaultMessageNotifications] The default message notifications
*/
/**
@@ -668,6 +669,11 @@ class Guild extends Base {
if (typeof data.explicitContentFilter !== 'undefined') {
_data.explicit_content_filter = Number(data.explicitContentFilter);
}
if (typeof data.defaultMessageNotifications !== 'undefined') {
_data.default_message_notifications = typeof data.defaultMessageNotifications === 'string' ?
DefaultMessageNotifications.indexOf(data.defaultMessageNotifications) :
Number(data.defaultMessageNotifications);
}
return this.client.api.guilds(this.id).patch({ data: _data, reason })
.then(newData => this.client.actions.GuildUpdate.handle(newData).updated);
}