Skip to content

Commit

Permalink
feat(Guild#defaultMessageNotifications) (#2538)
Browse files Browse the repository at this point in the history
* feat(Guild#defaultMessageNotifications)

* boolean -> DefaultMessageNotifications

* Space's requested change
  • Loading branch information
kyranet authored and Lewdcario committed May 28, 2018
1 parent f0c4d0e commit 30c7d6d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Invite = require('./Invite');
const GuildAuditLogs = require('./GuildAuditLogs');
const Webhook = require('./Webhook');
const VoiceRegion = require('./VoiceRegion');
const { ChannelTypes, Events, browser } = require('../util/Constants');
const { ChannelTypes, DefaultMessageNotifications, Events, browser } = require('../util/Constants');
const Collection = require('../util/Collection');
const Util = require('../util/Util');
const DataResolver = require('../util/DataResolver');
Expand Down Expand Up @@ -188,6 +188,13 @@ class Guild extends Base {
*/
this.joinedTimestamp = data.joined_at ? new Date(data.joined_at).getTime() : this.joinedTimestamp;

/**
* The value set for a guild's default message notifications
* @type {DefaultMessageNotifications|number}
*/
this.defaultMessageNotifications = DefaultMessageNotifications[data.default_message_notifications] ||
data.default_message_notifications;

this.id = data.id;
this.available = !data.unavailable;
this.features = data.features || this.features || [];
Expand Down
11 changes: 11 additions & 0 deletions src/util/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,17 @@ exports.APIErrors = {
REACTION_BLOCKED: 90001,
};

/**
* The value set for a guild's default message notifications, e.g. `ALL`. Here are the available types:
* * ALL
* * MENTIONS
* @typedef {string} DefaultMessageNotifications
*/
exports.DefaultMessageNotifications = [
'ALL',
'MENTIONS',
];

function keyMirror(arr) {
let tmp = Object.create(null);
for (const value of arr) tmp[value] = value;
Expand Down

0 comments on commit 30c7d6d

Please sign in to comment.