mirror of
https://github.com/danbulant/discord.js
synced 2026-07-06 11:40:41 +00:00
Webpack build for branch 11.3-dev: 6de5acbac3
This commit is contained in:
parent
084c837381
commit
3df66ff8e4
2 changed files with 151 additions and 18 deletions
|
|
@ -275,6 +275,8 @@ const Endpoints = exports.Endpoints = {
|
||||||
Asset: name => `${root}/assets/${name}`,
|
Asset: name => `${root}/assets/${name}`,
|
||||||
Avatar: (userID, hash) => `${root}/avatars/${userID}/${hash}.${hash.startsWith('a_') ? 'gif' : 'png?size=2048'}`,
|
Avatar: (userID, hash) => `${root}/avatars/${userID}/${hash}.${hash.startsWith('a_') ? 'gif' : 'png?size=2048'}`,
|
||||||
Icon: (guildID, hash) => `${root}/icons/${guildID}/${hash}.jpg`,
|
Icon: (guildID, hash) => `${root}/icons/${guildID}/${hash}.jpg`,
|
||||||
|
AppIcon: (clientID, hash) => `${root}/app-icons/${clientID}/${hash}.png`,
|
||||||
|
AppAsset: (clientID, hash) => `${root}/app-assets/${clientID}/${hash}.png`,
|
||||||
GDMIcon: (channelID, hash) => `${root}/channel-icons/${channelID}/${hash}.jpg?size=2048`,
|
GDMIcon: (channelID, hash) => `${root}/channel-icons/${channelID}/${hash}.jpg?size=2048`,
|
||||||
Splash: (guildID, hash) => `${root}/splashes/${guildID}/${hash}.jpg`,
|
Splash: (guildID, hash) => `${root}/splashes/${guildID}/${hash}.jpg`,
|
||||||
};
|
};
|
||||||
|
|
@ -435,6 +437,15 @@ exports.ActivityTypes = [
|
||||||
'WATCHING',
|
'WATCHING',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
exports.ActivityFlags = {
|
||||||
|
INSTANCE: 1 << 0,
|
||||||
|
JOIN: 1 << 1,
|
||||||
|
SPECTATE: 1 << 2,
|
||||||
|
JOIN_REQUEST: 1 << 3,
|
||||||
|
SYNC: 1 << 4,
|
||||||
|
PLAY: 1 << 5,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of a websocket message event, e.g. `MESSAGE_CREATE`. Here are the available events:
|
* The type of a websocket message event, e.g. `MESSAGE_CREATE`. Here are the available events:
|
||||||
* * READY
|
* * READY
|
||||||
|
|
@ -3314,7 +3325,7 @@ class User {
|
||||||
for (const guild of this.client.guilds.values()) {
|
for (const guild of this.client.guilds.values()) {
|
||||||
if (guild.presences.has(this.id)) return guild.presences.get(this.id);
|
if (guild.presences.has(this.id)) return guild.presences.get(this.id);
|
||||||
}
|
}
|
||||||
return new Presence();
|
return new Presence(undefined, this.client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3520,13 +3531,17 @@ module.exports = User;
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 11 */
|
/* 11 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
const { ActivityFlags, Endpoints } = __webpack_require__(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a user's presence.
|
* Represents a user's presence.
|
||||||
*/
|
*/
|
||||||
class Presence {
|
class Presence {
|
||||||
constructor(data = {}) {
|
constructor(data = {}, client) {
|
||||||
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The status of the presence:
|
* The status of the presence:
|
||||||
*
|
*
|
||||||
|
|
@ -3542,12 +3557,12 @@ class Presence {
|
||||||
* The game that the user is playing
|
* The game that the user is playing
|
||||||
* @type {?Game}
|
* @type {?Game}
|
||||||
*/
|
*/
|
||||||
this.game = data.game ? new Game(data.game) : null;
|
this.game = data.game ? new Game(data.game, this) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
update(data) {
|
update(data) {
|
||||||
this.status = data.status || this.status;
|
this.status = data.status || this.status;
|
||||||
this.game = data.game ? new Game(data.game) : null;
|
this.game = data.game ? new Game(data.game, this) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3568,7 +3583,9 @@ class Presence {
|
||||||
* Represents a game that is part of a user's presence.
|
* Represents a game that is part of a user's presence.
|
||||||
*/
|
*/
|
||||||
class Game {
|
class Game {
|
||||||
constructor(data) {
|
constructor(data, presence) {
|
||||||
|
Object.defineProperty(this, 'presence', { value: presence });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the game being played
|
* The name of the game being played
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
|
@ -3586,6 +3603,60 @@ class Game {
|
||||||
* @type {?string}
|
* @type {?string}
|
||||||
*/
|
*/
|
||||||
this.url = data.url || null;
|
this.url = data.url || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Details about the activity
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.details = data.details || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of the activity
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.state = data.state || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application ID associated with this activity
|
||||||
|
* @type {?Snowflake}
|
||||||
|
*/
|
||||||
|
this.applicationID = data.application_id || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps for the activity
|
||||||
|
* @type {?Object}
|
||||||
|
* @prop {?Date} start When the activity started
|
||||||
|
* @prop {?Date} end When the activity will end
|
||||||
|
*/
|
||||||
|
this.timestamps = data.timestamps ? {
|
||||||
|
start: data.timestamps.start ? new Date(Number(data.timestamps.start)) : null,
|
||||||
|
end: data.timestamps.end ? new Date(Number(data.timestamps.end)) : null,
|
||||||
|
} : null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Party of the activity
|
||||||
|
* @type {?Object}
|
||||||
|
* @prop {?string} id ID of the party
|
||||||
|
* @prop {number[]} size Size of the party as `[current, max]`
|
||||||
|
*/
|
||||||
|
this.party = data.party || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assets for rich presence
|
||||||
|
* @type {?RichPresenceAssets}
|
||||||
|
*/
|
||||||
|
this.assets = data.assets ? new RichPresenceAssets(this, data.assets) : null;
|
||||||
|
|
||||||
|
this.syncID = data.sync_id;
|
||||||
|
this._flags = data.flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
get flags() {
|
||||||
|
const flags = [];
|
||||||
|
for (const [name, flag] of Object.entries(ActivityFlags)) {
|
||||||
|
if ((this._flags & flag) === flag) flags.push(name);
|
||||||
|
}
|
||||||
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3620,8 +3691,67 @@ class Game {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assets for a rich presence
|
||||||
|
*/
|
||||||
|
class RichPresenceAssets {
|
||||||
|
constructor(game, assets) {
|
||||||
|
Object.defineProperty(this, 'game', { value: game });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hover text for the large image
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.largeText = assets.large_text || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hover text for the small image
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.smallText = assets.small_text || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the large image asset
|
||||||
|
* @type {?Snowflake}
|
||||||
|
*/
|
||||||
|
this.largeImage = assets.large_image || null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the small image asset
|
||||||
|
* @type {?Snowflake}
|
||||||
|
*/
|
||||||
|
this.smallImage = assets.small_image || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URL of the small image asset
|
||||||
|
* @type {?string}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get smallImageURL() {
|
||||||
|
if (!this.smallImage) return null;
|
||||||
|
return Endpoints.CDN(this.game.presence.client.options.http.cdn)
|
||||||
|
.AppAsset(this.game.applicationID, this.smallImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URL of the large image asset
|
||||||
|
* @type {?string}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get largeImageURL() {
|
||||||
|
if (!this.largeImage) return null;
|
||||||
|
if (/^spotify:/.test(this.largeImage)) {
|
||||||
|
return `https://i.scdn.co/image/${this.largeImage.slice(8)}`;
|
||||||
|
}
|
||||||
|
return Endpoints.CDN(this.game.presence.client.options.http.cdn)
|
||||||
|
.AppAsset(this.game.applicationID, this.largeImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exports.Presence = Presence;
|
exports.Presence = Presence;
|
||||||
exports.Game = Game;
|
exports.Game = Game;
|
||||||
|
exports.RichPresenceAssets = RichPresenceAssets;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
@ -6945,7 +7075,7 @@ const TextBasedChannel = __webpack_require__(14);
|
||||||
const Role = __webpack_require__(8);
|
const Role = __webpack_require__(8);
|
||||||
const Permissions = __webpack_require__(5);
|
const Permissions = __webpack_require__(5);
|
||||||
const Collection = __webpack_require__(3);
|
const Collection = __webpack_require__(3);
|
||||||
const Presence = __webpack_require__(11).Presence;
|
const { Presence } = __webpack_require__(11);
|
||||||
const util = __webpack_require__(7);
|
const util = __webpack_require__(7);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -6974,6 +7104,12 @@ class GuildMember {
|
||||||
*/
|
*/
|
||||||
this.user = {};
|
this.user = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The timestamp this member joined the guild at
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.joinedTimestamp = null;
|
||||||
|
|
||||||
this._roles = [];
|
this._roles = [];
|
||||||
if (data) this.setup(data);
|
if (data) this.setup(data);
|
||||||
|
|
||||||
|
|
@ -7039,11 +7175,7 @@ class GuildMember {
|
||||||
*/
|
*/
|
||||||
this.nickname = data.nick || null;
|
this.nickname = data.nick || null;
|
||||||
|
|
||||||
/**
|
if (data.joined_at) this.joinedTimestamp = new Date(data.joined_at).getTime();
|
||||||
* The timestamp this member joined the guild at
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
this.joinedTimestamp = new Date(data.joined_at).getTime();
|
|
||||||
|
|
||||||
this.user = data.user;
|
this.user = data.user;
|
||||||
this._roles = data.roles;
|
this._roles = data.roles;
|
||||||
|
|
@ -7055,7 +7187,7 @@ class GuildMember {
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get joinedAt() {
|
get joinedAt() {
|
||||||
return new Date(this.joinedTimestamp);
|
return this.joinedTimestamp ? new Date(this.joinedTimestamp) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7064,7 +7196,7 @@ class GuildMember {
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get presence() {
|
get presence() {
|
||||||
return this.frozenPresence || this.guild.presences.get(this.id) || new Presence();
|
return this.frozenPresence || this.guild.presences.get(this.id) || new Presence(undefined, this.client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -9211,7 +9343,8 @@ class Guild {
|
||||||
fetchMember(user, cache = true) {
|
fetchMember(user, cache = true) {
|
||||||
user = this.client.resolver.resolveUser(user);
|
user = this.client.resolver.resolveUser(user);
|
||||||
if (!user) return Promise.reject(new Error('Invalid or uncached id provided.'));
|
if (!user) return Promise.reject(new Error('Invalid or uncached id provided.'));
|
||||||
if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id));
|
const member = this.members.get(user.id);
|
||||||
|
if (member && member.joinedTimestamp) return Promise.resolve(member);
|
||||||
return this.client.rest.methods.getGuildMember(this, user, cache);
|
return this.client.rest.methods.getGuildMember(this, user, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9851,7 +9984,7 @@ class Guild {
|
||||||
this.presences.get(id).update(presence);
|
this.presences.get(id).update(presence);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.presences.set(id, new Presence(presence));
|
this.presences.set(id, new Presence(presence, this.client));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -17659,7 +17792,7 @@ class Client extends EventEmitter {
|
||||||
this.presences.get(id).update(presence);
|
this.presences.get(id).update(presence);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.presences.set(id, new Presence(presence));
|
this.presences.set(id, new Presence(presence, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
2
discord.11.3-dev.min.js
vendored
2
discord.11.3-dev.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue