Webpack build for branch indev-prism: ba465bc680

This commit is contained in:
Travis CI 2017-01-15 14:21:50 +00:00
parent 714223e9f9
commit 1a7cfce99b
2 changed files with 188 additions and 132 deletions

View file

@ -473,7 +473,7 @@ for (const key in PermissionFlags) _ALL_PERMISSIONS |= PermissionFlags[key];
exports.ALL_PERMISSIONS = _ALL_PERMISSIONS;
exports.DEFAULT_PERMISSIONS = 104324097;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19)))
/***/ }),
/* 1 */
@ -1965,7 +1965,7 @@ module.exports = Emoji;
const TextBasedChannel = __webpack_require__(13);
const Role = __webpack_require__(9);
const EvaluatedPermissions = __webpack_require__(19);
const EvaluatedPermissions = __webpack_require__(20);
const Constants = __webpack_require__(0);
const Collection = __webpack_require__(3);
const Presence = __webpack_require__(7).Presence;
@ -2416,7 +2416,7 @@ const Embed = __webpack_require__(37);
const MessageReaction = __webpack_require__(38);
const Collection = __webpack_require__(3);
const Constants = __webpack_require__(0);
const escapeMarkdown = __webpack_require__(22);
const escapeMarkdown = __webpack_require__(23);
let GuildMember;
/**
@ -3351,16 +3351,17 @@ class TextBasedChannel {
}
/**
* Bulk delete given messages.
* Bulk delete given messages that are newer than two weeks
* <warn>This is only available when using a bot account.</warn>
* @param {Collection<string, Message>|Message[]|number} messages Messages to delete, or number of messages to delete
* @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically
* @returns {Promise<Collection<string, Message>>} Deleted messages
*/
bulkDelete(messages) {
bulkDelete(messages, filterOld = false) {
if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs));
if (messages instanceof Array || messages instanceof Collection) {
const messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id);
return this.client.rest.methods.bulkDeleteMessages(this, messageIDs);
return this.client.rest.methods.bulkDeleteMessages(this, messageIDs, filterOld);
}
throw new TypeError('The messages must be an Array, Collection, or number.');
}
@ -3730,14 +3731,15 @@ class Guild {
/**
* Fetch a single guild member from a user.
* @param {UserResolvable} user The user to fetch the member for
* @param {boolean} [cache=true] Insert the user into the users cache
* @returns {Promise<GuildMember>}
*/
fetchMember(user) {
fetchMember(user, cache = true) {
if (this._fetchWaiter) return Promise.reject(new Error('Already fetching guild members.'));
user = this.client.resolver.resolveUser(user);
if (!user) return Promise.reject(new Error('User is not cached. Use Client.fetchUser first.'));
if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id));
return this.client.rest.methods.getGuildMember(this, user);
return this.client.rest.methods.getGuildMember(this, user, cache);
}
/**
@ -3748,7 +3750,7 @@ class Guild {
*/
fetchMembers(query = '') {
return new Promise((resolve, reject) => {
if (this._fetchWaiter) throw new Error('Already fetching guild members in ${this.id}.');
if (this._fetchWaiter) throw new Error(`Already fetching guild members in ${this.id}.`);
if (this.memberCount === this.members.size) {
resolve(this);
return;
@ -4282,7 +4284,7 @@ module.exports = Guild;
const Channel = __webpack_require__(8);
const Role = __webpack_require__(9);
const PermissionOverwrites = __webpack_require__(42);
const EvaluatedPermissions = __webpack_require__(19);
const EvaluatedPermissions = __webpack_require__(20);
const Constants = __webpack_require__(0);
const Collection = __webpack_require__(3);
@ -4584,6 +4586,77 @@ module.exports = GuildChannel;
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
const Long = __webpack_require__(46);
// Discord epoch (2015-01-01T00:00:00.000Z)
const EPOCH = 1420070400000;
let INCREMENT = 0;
/**
* A container for useful snowflake-related methods
*/
class SnowflakeUtil {
/**
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
* ```
* If we have a snowflake '266241948824764416' we can represent it as binary:
*
* 64 22 17 12 0
* 000000111011000111100001101001000101000000 00001 00000 000000000000
* number of ms since discord epoch worker pid increment
* ```
* @typedef {string} Snowflake
*/
/**
* Generates a Discord snowflake
* <info>This hardcodes the worker ID as 1 and the process ID as 0.</info>
* @returns {Snowflake} The generated snowflake
*/
static generate() {
if (INCREMENT >= 4095) INCREMENT = 0;
const BINARY = `${pad((Date.now() - EPOCH).toString(2), 42)}0000100000${pad((INCREMENT++).toString(2), 12)}`;
return Long.fromString(BINARY, 2).toString();
}
/**
* A deconstructed snowflake
* @typedef {Object} DeconstructedSnowflake
* @property {Date} date Date in the snowflake
* @property {number} workerID Worker ID in the snowflake
* @property {number} processID Process ID in the snowflake
* @property {number} increment Increment in the snowflake
* @property {string} binary Binary representation of the snowflake
*/
/**
* Deconstructs a Discord snowflake
* @param {Snowflake} snowflake Snowflake to deconstruct
* @returns {DeconstructedSnowflake} Deconstructed snowflake
*/
static deconstruct(snowflake) {
const BINARY = pad(Long.fromString(snowflake).toString(2), 64);
return {
date: new Date(parseInt(BINARY.substring(0, 42), 2) + EPOCH),
workerID: parseInt(BINARY.substring(42, 47), 2),
processID: parseInt(BINARY.substring(47, 52), 2),
increment: parseInt(BINARY.substring(52, 64), 2),
binary: BINARY,
};
}
}
function pad(v, n, c = '0') {
return String(v).length >= n ? String(v) : (String(c).repeat(n) + v).slice(-n);
}
module.exports = SnowflakeUtil;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
* The buffer module from node.js, for the browser.
@ -6378,7 +6451,7 @@ function isnan (val) {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(52)))
/***/ }),
/* 17 */
/* 18 */
/***/ (function(module, exports) {
// Copyright Joyent, Inc. and other Node contributors.
@ -6686,7 +6759,7 @@ function isUndefined(arg) {
/***/ }),
/* 18 */
/* 19 */
/***/ (function(module, exports) {
// shim for using process in browser
@ -6872,7 +6945,7 @@ process.umask = function() { return 0; };
/***/ }),
/* 19 */
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
const Constants = __webpack_require__(0);
@ -6945,7 +7018,7 @@ module.exports = EvaluatedPermissions;
/***/ }),
/* 20 */
/* 21 */
/***/ (function(module, exports) {
/**
@ -7000,7 +7073,7 @@ module.exports = ReactionEmoji;
/***/ }),
/* 21 */
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
const path = __webpack_require__(25);
@ -7221,7 +7294,7 @@ module.exports = Webhook;
/***/ }),
/* 22 */
/* 23 */
/***/ (function(module, exports) {
module.exports = function escapeMarkdown(text, onlyCodeBlock = false, onlyInlineCode = false) {
@ -7231,77 +7304,6 @@ module.exports = function escapeMarkdown(text, onlyCodeBlock = false, onlyInline
};
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
const Long = __webpack_require__(46);
// Discord epoch (2015-01-01T00:00:00.000Z)
const EPOCH = 1420070400000;
let INCREMENT = 0;
/**
* A container for useful snowflake-related methods
*/
class SnowflakeUtil {
/**
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
* ```
* If we have a snowflake '266241948824764416' we can represent it as binary:
*
* 64 22 17 12 0
* 000000111011000111100001101001000101000000 00001 00000 000000000000
* number of ms since discord epoch worker pid increment
* ```
* @typedef {string} Snowflake
*/
/**
* Generates a Discord snowflake
* <info>This hardcodes the worker ID as 1 and the process ID as 0.</info>
* @returns {Snowflake} The generated snowflake
*/
static generate() {
if (INCREMENT >= 4095) INCREMENT = 0;
const BINARY = `${pad((Date.now() - EPOCH).toString(2), 42)}0000100000${pad((INCREMENT++).toString(2), 12)}`;
return Long.fromString(BINARY, 2).toString();
}
/**
* A deconstructed snowflake
* @typedef {Object} DeconstructedSnowflake
* @property {Date} date Date in the snowflake
* @property {number} workerID Worker ID in the snowflake
* @property {number} processID Process ID in the snowflake
* @property {number} increment Increment in the snowflake
* @property {string} binary Binary representation of the snowflake
*/
/**
* Deconstructs a Discord snowflake
* @param {Snowflake} snowflake Snowflake to deconstruct
* @returns {DeconstructedSnowflake} Deconstructed snowflake
*/
static deconstruct(snowflake) {
const BINARY = pad(Long.fromString(snowflake).toString(2), 64);
return {
date: new Date(parseInt(BINARY.substring(0, 42), 2) + EPOCH),
workerID: parseInt(BINARY.substring(42, 47), 2),
processID: parseInt(BINARY.substring(47, 52), 2),
increment: parseInt(BINARY.substring(52, 64), 2),
binary: BINARY,
};
}
}
function pad(v, n, c = '0') {
return String(v).length >= n ? String(v) : (String(c).repeat(n) + v).slice(-n);
}
module.exports = SnowflakeUtil;
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
@ -7551,7 +7553,7 @@ var substr = 'ab'.substr(-1) === 'b'
}
;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19)))
/***/ }),
/* 26 */
@ -8498,7 +8500,7 @@ const Guild = __webpack_require__(14);
const Channel = __webpack_require__(8);
const GuildMember = __webpack_require__(11);
const Emoji = __webpack_require__(10);
const ReactionEmoji = __webpack_require__(20);
const ReactionEmoji = __webpack_require__(21);
/**
* The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g.
@ -8873,7 +8875,7 @@ class ClientDataResolver {
module.exports = ClientDataResolver;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16).Buffer))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17).Buffer))
/***/ }),
/* 29 */
@ -9303,6 +9305,14 @@ class ClientUser extends User {
);
}
}
/**
* @param {Invite|string} invite Invite or code to accept
* @returns {Promise<Guild>} Joined guild
*/
acceptInvite(invite) {
return this.client.rest.methods.acceptInvite(invite);
}
}
module.exports = ClientUser;
@ -9769,7 +9779,7 @@ module.exports = MessageAttachment;
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
const EventEmitter = __webpack_require__(17).EventEmitter;
const EventEmitter = __webpack_require__(18).EventEmitter;
const Collection = __webpack_require__(3);
/**
@ -10227,7 +10237,7 @@ module.exports = MessageEmbed;
const Collection = __webpack_require__(3);
const Emoji = __webpack_require__(10);
const ReactionEmoji = __webpack_require__(20);
const ReactionEmoji = __webpack_require__(21);
/**
* Represents a reaction to a message
@ -10717,13 +10727,23 @@ class VoiceChannel extends GuildChannel {
return null;
}
/**
* Checks if the voice channel is full
* @type {boolean}
*/
get full() {
return this.members.size >= this.userLimit;
}
/**
* Checks if the client has permission join the voice channel
* @type {boolean}
*/
get joinable() {
if (this.client.browser) return false;
return this.permissionsFor(this.client.user).hasPermission('CONNECT');
if (!this.permissionsFor(this.client.user).hasPermission('CONNECT')) return false;
if (this.full && !this.permissionsFor(this.client.user).hasPermission('MOVE_MEMBERS')) return false;
return true;
}
/**
@ -12567,7 +12587,7 @@ module.exports = function convertArrayBuffer(x) {
return Buffer.from(x);
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16).Buffer))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17).Buffer))
/***/ }),
/* 57 */
@ -12591,7 +12611,7 @@ module.exports = function merge(def, given) {
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {const EventEmitter = __webpack_require__(17).EventEmitter;
/* WEBPACK VAR INJECTION */(function(process) {const EventEmitter = __webpack_require__(18).EventEmitter;
const mergeDefault = __webpack_require__(57);
const Constants = __webpack_require__(0);
const RESTManager = __webpack_require__(54);
@ -12880,11 +12900,12 @@ class Client extends EventEmitter {
* Caches a user, or obtains it from the cache if it's already cached.
* <warn>This is only available when using a bot account.</warn>
* @param {string} id The ID of the user to obtain
* @param {boolean} [cache=true] Insert the user into the users cache
* @returns {Promise<User>}
*/
fetchUser(id) {
fetchUser(id, cache = true) {
if (this.users.has(id)) return Promise.resolve(this.users.get(id));
return this.rest.methods.getUser(id);
return this.rest.methods.getUser(id, cache);
}
/**
@ -13087,13 +13108,13 @@ module.exports = Client;
* @param {string} info The debug information
*/
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19)))
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
const Webhook = __webpack_require__(21);
const Webhook = __webpack_require__(22);
const RESTManager = __webpack_require__(54);
const ClientDataResolver = __webpack_require__(28);
const mergeDefault = __webpack_require__(57);
@ -20341,7 +20362,7 @@ exports.encode = exports.stringify = __webpack_require__(79);
attachTo.clearImmediate = clearImmediate;
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(52), __webpack_require__(18)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(52), __webpack_require__(19)))
/***/ }),
/* 82 */
@ -21562,7 +21583,9 @@ class GuildDeleteAction extends Action {
let guild = client.guilds.get(data.id);
if (guild) {
for (const channel of guild.channels.values()) channel.stopTyping(true);
for (const channel of guild.channels.values()) {
if (channel.type === 'text') channel.stopTyping(true);
}
if (guild.available && data.unavailable) {
// guild is unavailable
@ -22444,15 +22467,16 @@ const Constants = __webpack_require__(0);
const Collection = __webpack_require__(3);
const splitMessage = __webpack_require__(45);
const parseEmoji = __webpack_require__(161);
const escapeMarkdown = __webpack_require__(22);
const escapeMarkdown = __webpack_require__(23);
const transformSearchOptions = __webpack_require__(162);
const Snowflake = __webpack_require__(16);
const User = __webpack_require__(6);
const GuildMember = __webpack_require__(11);
const Message = __webpack_require__(12);
const Role = __webpack_require__(9);
const Invite = __webpack_require__(34);
const Webhook = __webpack_require__(21);
const Webhook = __webpack_require__(22);
const UserProfile = __webpack_require__(159);
const ClientOAuth2Application = __webpack_require__(30);
const Channel = __webpack_require__(8);
@ -22577,7 +22601,12 @@ class RESTMethods {
);
}
bulkDeleteMessages(channel, messages) {
bulkDeleteMessages(channel, messages, filterOld) {
if (filterOld) {
messages = messages.filter(id =>
Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000
);
}
return this.rest.makeRequest('post', `${Constants.Endpoints.channelMessages(channel.id)}/bulk_delete`, true, {
messages,
}).then(() =>
@ -22699,10 +22728,14 @@ class RESTMethods {
);
}
getUser(userID) {
return this.rest.makeRequest('get', Constants.Endpoints.user(userID), true).then(data =>
this.client.actions.UserGet.handle(data).user
);
getUser(userID, cache) {
return this.rest.makeRequest('get', Constants.Endpoints.user(userID), true).then(data => {
if (cache) {
return this.client.actions.UserGet.handle(data).user;
} else {
return new User(this.client, data);
}
});
}
updateCurrentUser(_data, password) {
@ -22792,10 +22825,14 @@ class RESTMethods {
return this.rest.makeRequest('get', Constants.Endpoints.channelMessage(channel.id, messageID), true);
}
getGuildMember(guild, user) {
return this.rest.makeRequest('get', Constants.Endpoints.guildMember(guild.id, user.id), true).then(data =>
this.client.actions.GuildMemberGet.handle(guild, data).member
);
getGuildMember(guild, user, cache) {
return this.rest.makeRequest('get', Constants.Endpoints.guildMember(guild.id, user.id), true).then(data => {
if (cache) {
return this.client.actions.GuildMemberGet.handle(guild, data).member;
} else {
return new GuildMember(guild, data);
}
});
}
updateGuildMember(member, data) {
@ -23142,6 +23179,25 @@ class RESTMethods {
setNote(user, note) {
return this.rest.makeRequest('put', Constants.Endpoints.note(user.id), true, { note }).then(() => user);
}
acceptInvite(code) {
if (code.id) code = code.id;
return new Promise((resolve, reject) =>
this.rest.makeRequest('post', Constants.Endpoints.invite(code), true).then((res) => {
const handler = guild => {
if (guild.id === res.id) {
resolve(guild);
this.client.removeListener('guildCreate', handler);
}
};
this.client.on('guildCreate', handler);
this.client.setTimeout(() => {
this.client.removeListener('guildCreate', handler);
reject(new Error('Accepting invite timed out'));
}, 120e3);
})
);
}
}
module.exports = RESTMethods;
@ -23365,7 +23421,7 @@ module.exports = UserAgentManager;
/* 121 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer, setImmediate) {const EventEmitter = __webpack_require__(17).EventEmitter;
/* WEBPACK VAR INJECTION */(function(Buffer, setImmediate) {const EventEmitter = __webpack_require__(18).EventEmitter;
const Prism = __webpack_require__(166);
const OpusEncoders = __webpack_require__(165);
const Collection = __webpack_require__(3);
@ -23736,14 +23792,14 @@ class VoiceBroadcast extends EventEmitter {
module.exports = VoiceBroadcast;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16).Buffer, __webpack_require__(86).setImmediate))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17).Buffer, __webpack_require__(86).setImmediate))
/***/ }),
/* 122 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = typeof window !== 'undefined';
const EventEmitter = __webpack_require__(17).EventEmitter;
const EventEmitter = __webpack_require__(18).EventEmitter;
const Constants = __webpack_require__(0);
const convertArrayBuffer = __webpack_require__(56);
const pako = __webpack_require__(69);
@ -24115,7 +24171,7 @@ class WebSocketManager extends EventEmitter {
module.exports = WebSocketManager;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16).Buffer))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17).Buffer))
/***/ }),
/* 123 */
@ -25520,17 +25576,17 @@ module.exports = {
Collection: __webpack_require__(3),
splitMessage: __webpack_require__(45),
escapeMarkdown: __webpack_require__(22),
escapeMarkdown: __webpack_require__(23),
fetchRecommendedShards: __webpack_require__(61),
Snowflake: __webpack_require__(23),
SnowflakeUtil: __webpack_require__(23),
Snowflake: __webpack_require__(16),
SnowflakeUtil: __webpack_require__(16),
Channel: __webpack_require__(8),
ClientOAuth2Application: __webpack_require__(30),
ClientUser: __webpack_require__(31),
DMChannel: __webpack_require__(32),
Emoji: __webpack_require__(10),
EvaluatedPermissions: __webpack_require__(19),
EvaluatedPermissions: __webpack_require__(20),
Game: __webpack_require__(7).Game,
GroupDMChannel: __webpack_require__(33),
Guild: __webpack_require__(14),
@ -25547,13 +25603,13 @@ module.exports = {
PartialGuildChannel: __webpack_require__(41),
PermissionOverwrites: __webpack_require__(42),
Presence: __webpack_require__(7).Presence,
ReactionEmoji: __webpack_require__(20),
ReactionEmoji: __webpack_require__(21),
RichEmbed: __webpack_require__(60),
Role: __webpack_require__(9),
TextChannel: __webpack_require__(43),
User: __webpack_require__(6),
VoiceChannel: __webpack_require__(44),
Webhook: __webpack_require__(21),
Webhook: __webpack_require__(22),
version: __webpack_require__(29).version,
Constants: __webpack_require__(0),

File diff suppressed because one or more lines are too long