diff --git a/discord.master.js b/discord.master.js
index 0d8beda1..ec166ae5 100644
--- a/discord.master.js
+++ b/discord.master.js
@@ -63,7 +63,7 @@
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 145);
+/******/ return __webpack_require__(__webpack_require__.s = 147);
/******/ })
/************************************************************************/
/******/ ([
@@ -382,6 +382,7 @@ exports.Events = {
MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll',
USER_UPDATE: 'userUpdate',
USER_NOTE_UPDATE: 'userNoteUpdate',
+ USER_SETTINGS_UPDATE: 'clientUserSettingsUpdate',
PRESENCE_UPDATE: 'presenceUpdate',
VOICE_STATE_UPDATE: 'voiceStateUpdate',
TYPING_START: 'typingStart',
@@ -422,6 +423,7 @@ exports.Events = {
* - MESSAGE_REACTION_REMOVE_ALL
* - USER_UPDATE
* - USER_NOTE_UPDATE
+ * - USER_SETTINGS_UPDATE
* - PRESENCE_UPDATE
* - VOICE_STATE_UPDATE
* - TYPING_START
@@ -460,6 +462,7 @@ exports.WSEvents = {
MESSAGE_REACTION_REMOVE_ALL: 'MESSAGE_REACTION_REMOVE_ALL',
USER_UPDATE: 'USER_UPDATE',
USER_NOTE_UPDATE: 'USER_NOTE_UPDATE',
+ USER_SETTINGS_UPDATE: 'USER_SETTINGS_UPDATE',
PRESENCE_UPDATE: 'PRESENCE_UPDATE',
VOICE_STATE_UPDATE: 'VOICE_STATE_UPDATE',
TYPING_START: 'TYPING_START',
@@ -488,6 +491,145 @@ exports.DefaultAvatars = {
RED: '1cbd08c76f8af6dddce02c5138971129',
};
+exports.ExplicitContentFilterTypes = [
+ 'DISABLED',
+ 'NON_FRIENDS',
+ 'FRIENDS_AND_NON_FRIENDS',
+];
+
+exports.UserSettingsMap = {
+ /**
+ * Automatically convert emoticons in your messages to emoji.
+ * For example, when you type `:-)` Discord will convert it to 😃
+ * @name ClientUserSettings#convertEmoticons
+ * @type {boolean}
+ */
+ convert_emoticons: 'convertEmoticons',
+
+ /**
+ * If new guilds should automatically disable DMs between you and its members
+ * @name ClientUserSettings#defaultGuildsRestricted
+ * @type {boolean}
+ */
+ default_guilds_restricted: 'defaultGuildsRestricted',
+
+ /**
+ * Automatically detect accounts from services like Steam and Blizzard when you open the Discord client
+ * @name ClientUserSettings#detectPlatformAccounts
+ * @type {boolean}
+ */
+ detect_platform_accounts: 'detectPlatformAccounts',
+
+ /**
+ * Developer Mode exposes context menu items helpful for people writing bots using the Discord API
+ * @name ClientUserSettings#developerMode
+ * @type {boolean}
+ */
+ developer_mode: 'developerMode',
+
+ /**
+ * Allow playback and usage of the `/tts` command
+ * @name ClientUserSettings#enableTTSCommand
+ * @type {boolean}
+ */
+ enable_tts_command: 'enableTTSCommand',
+
+ /**
+ * The theme of the client. Either `light` or `dark`
+ * @name ClientUserSettings#theme
+ * @type {String}
+ */
+ theme: 'theme',
+
+ /**
+ * Last status set in the client
+ * @name ClientUserSettings#status
+ * @type {PresenceStatus}
+ */
+ status: 'status',
+
+ /**
+ * Display currently running game as status message
+ * @name ClientUserSettings#showCurrentGame
+ * @type {boolean}
+ */
+ show_current_game: 'showCurrentGame',
+
+ /**
+ * Display images, videos, and lolcats when uploaded directly to Discord
+ * @name ClientUserSettings#inlineAttachmentMedia
+ * @type {boolean}
+ */
+ inline_attachment_media: 'inlineAttachmentMedia',
+
+ /**
+ * Display images, videos, and lolcats when uploaded posted as links in chat
+ * @name ClientUserSettings#inlineEmbedMedia
+ * @type {boolean}
+ */
+ inline_embed_media: 'inlineEmbedMedia',
+
+ /**
+ * Language the Discord client will use, as an RFC 3066 language identifier
+ * @name ClientUserSettings#locale
+ * @type {string}
+ */
+ locale: 'locale',
+
+ /**
+ * Display messages in compact mode
+ * @name ClientUserSettings#messageDisplayCompact
+ * @type {boolean}
+ */
+ message_display_compact: 'messageDisplayCompact',
+
+ /**
+ * Show emoji reactions on messages
+ * @name ClientUserSettings#renderReactions
+ * @type {boolean}
+ */
+ render_reactions: 'renderReactions',
+
+ /**
+ * Array of snowflake IDs for guilds, in the order they appear in the Discord client
+ * @name ClientUserSettings#guildPositions
+ * @type {Snowflake[]}
+ */
+ guild_positions: 'guildPositions',
+
+ /**
+ * Array of snowflake IDs for guilds which you will not recieve DMs from
+ * @name ClientUserSettings#restrictedGuilds
+ * @type {Snowflake[]}
+ */
+ restricted_guilds: 'restrictedGuilds',
+
+ explicit_content_filter: function explicitContentFilter(type) { // eslint-disable-line func-name-matching
+ /**
+ * Safe direct messaging; force people's messages with images to be scanned before they are sent to you
+ * one of `DISABLED`, `NON_FRIENDS`, `FRIENDS_AND_NON_FRIENDS`
+ * @name ClientUserSettings#explicitContentFilter
+ * @type {string}
+ */
+ return exports.ExplicitContentFilterTypes[type];
+ },
+ friend_source_flags: function friendSources(flags) { // eslint-disable-line func-name-matching
+ /**
+ * Who can add you as a friend
+ * @name ClientUserSettings#friendSources
+ * @type {Object}
+ * @property {boolean} all Mutual friends and mutual guilds
+ * @property {boolean} mutualGuilds Only mutual guilds
+ * @property {boolean} mutualFriends Only mutual friends
+ */
+ return {
+ all: flags.all || false,
+ mutualGuilds: flags.all ? true : flags.mutual_guilds || false,
+ mutualFriends: flags.all ? true : flags.mutualFriends || false,
+ };
+ },
+};
+
exports.Colors = {
DEFAULT: 0x000000,
AQUA: 0x1ABC9C,
@@ -1160,7 +1302,7 @@ class Util {
* @param {*} element Element to move
* @param {number} newIndex Index or offset to move the element to
* @param {boolean} [offset=false] Move the element by an offset amount rather than to a set index
- * @returns {Array<*>}
+ * @returns {number}
* @private
*/
static moveElementInArray(array, element, newIndex, offset = false) {
@@ -1170,7 +1312,7 @@ class Util {
const removedElement = array.splice(index, 1)[0];
array.splice(newIndex, 0, removedElement);
}
- return array;
+ return array.indexOf(element);
}
}
@@ -1690,9 +1832,9 @@ module.exports = Channel;
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
-const Attachment = __webpack_require__(32);
-const Embed = __webpack_require__(34);
-const MessageReaction = __webpack_require__(35);
+const Attachment = __webpack_require__(33);
+const Embed = __webpack_require__(35);
+const MessageReaction = __webpack_require__(36);
const Util = __webpack_require__(4);
const Collection = __webpack_require__(3);
const Constants = __webpack_require__(0);
@@ -3592,9 +3734,9 @@ module.exports = GuildMember;
-var base64 = __webpack_require__(51)
-var ieee754 = __webpack_require__(52)
-var isArray = __webpack_require__(53)
+var base64 = __webpack_require__(52)
+var ieee754 = __webpack_require__(53)
+var isArray = __webpack_require__(54)
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
@@ -5372,7 +5514,7 @@ function isnan (val) {
return val !== val // eslint-disable-line no-self-compare
}
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(62)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(63)))
/***/ }),
/* 15 */
@@ -5380,7 +5522,7 @@ function isnan (val) {
const path = __webpack_require__(19);
const Message = __webpack_require__(9);
-const MessageCollector = __webpack_require__(33);
+const MessageCollector = __webpack_require__(34);
const Collection = __webpack_require__(3);
/**
@@ -6213,6 +6355,17 @@ class Guild {
}
/**
+ * Get the position of this guild
+ * This is only available when using a user account.
+ * @type {?number}
+ */
+ get position() {
+ if (this.client.user.bot) return null;
+ if (!this.client.user.settings.guildPositions) return null;
+ return this.client.user.settings.guildPositions.indexOf(this.id);
+ }
+
+ /*
* The `@everyone` Role of the guild.
* @type {Role}
* @readonly
@@ -6698,6 +6851,29 @@ class Guild {
return this.client.rest.methods.ackGuild(this);
}
+ /**
+ * @param {number} position Absolute or relative position
+ * @param {boolean} [relative=false] Whether to position relatively or absolutely
+ * @returns {Promise}
+ */
+ setPosition(position, relative) {
+ if (this.client.user.bot) {
+ return Promise.reject(new Error('Setting guild position is only available for user accounts'));
+ }
+ return this.client.user.settings.setGuildPosition(this, position, relative);
+ }
+
+ /**
+ * Allow direct messages from guild members
+ * @param {boolean} allow Whether to allow direct messages
+ * @returns {Promise}
+ */
+ allowDMs(allow) {
+ const settings = this.client.user.settings;
+ if (allow) return settings.removeRestrictedGuild(this);
+ else return settings.addRestrictedGuild(this);
+ }
+
/**
* Whether this Guild equals another Guild. It compares all properties, so for most operations
* it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often
@@ -6918,7 +7094,7 @@ module.exports = Guild;
const Channel = __webpack_require__(8);
const Role = __webpack_require__(10);
-const PermissionOverwrites = __webpack_require__(39);
+const PermissionOverwrites = __webpack_require__(40);
const Permissions = __webpack_require__(6);
const Collection = __webpack_require__(3);
@@ -9675,8 +9851,8 @@ if (browser) {
fetch = window.fetch; // eslint-disable-line no-undef
FormData = window.FormData; // eslint-disable-line no-undef
} else {
- fetch = __webpack_require__(138);
- FormData = __webpack_require__(58);
+ fetch = __webpack_require__(140);
+ FormData = __webpack_require__(59);
}
class Fetcher {
@@ -9786,7 +9962,7 @@ class Fetcher {
const methods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH', 'BREW'];
for (const method of methods) Fetcher[method.toLowerCase()] = (url) => new Fetcher(method, url);
-Fetcher.version = __webpack_require__(57).version;
+Fetcher.version = __webpack_require__(58).version;
module.exports = Fetcher;
if (browser) window.Fetcher = Fetcher;
@@ -9816,7 +9992,7 @@ function parseWWWFormUrlEncoded(str) {
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(19);
-const fs = __webpack_require__(42);
+const fs = __webpack_require__(43);
const snekfetch = __webpack_require__(26);
const Constants = __webpack_require__(0);
@@ -10246,7 +10422,7 @@ module.exports = {
const User = __webpack_require__(11);
const Collection = __webpack_require__(3);
-
+const ClientUserSettings = __webpack_require__(30);
/**
* Represents the logged in client's Discord user
* @extends {User}
@@ -10290,13 +10466,6 @@ class ClientUser extends User {
*/
this.notes = new Collection();
- /**
- * Discord client settings, such as guild positions
- * This is only filled when using a user account.
- * @type {Object}
- */
- this.settings = {};
-
/**
* If the user has discord premium (nitro)
* This is only filled when using a user account.
@@ -10317,6 +10486,13 @@ class ClientUser extends User {
* @type {?boolean}
*/
this.mobile = typeof data.mobile === 'boolean' ? data.mobile : null;
+
+ /**
+ * Various settings for this user
+ * @type {?ClientUserSettings}
+ * This is only filled when using a user account
+ */
+ if (data.user_settings) this.settings = new ClientUserSettings(this, data.user_settings);
}
edit(data) {
@@ -10588,6 +10764,89 @@ module.exports = ClientUser;
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
+const Constants = __webpack_require__(0);
+const Util = __webpack_require__(4);
+
+/**
+ * A wrapper around the ClientUser's settings
+ */
+class ClientUserSettings {
+ constructor(user, data) {
+ this.user = user;
+ this.patch(data);
+ }
+
+ /**
+ * Patch the data contained in this class with new partial data
+ * @param {Object} data Data to patch this with
+ */
+ patch(data) {
+ for (const key of Object.keys(Constants.UserSettingsMap)) {
+ const value = Constants.UserSettingsMap[key];
+ if (!data.hasOwnProperty(key)) continue;
+ if (typeof value === 'function') {
+ this[value.name] = value(data[key]);
+ } else {
+ this[value] = data[key];
+ }
+ }
+ }
+
+ /**
+ * Update a specific property of of user settings
+ * @param {string} name Name of property
+ * @param {value} value Value to patch
+ * @returns {Promise