diff --git a/discord.11.5-dev.js b/discord.11.5-dev.js index 339b776b..1254f8ce 100644 --- a/discord.11.5-dev.js +++ b/discord.11.5-dev.js @@ -1733,7 +1733,7 @@ eval("const Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const { ActivityFlags, Endpoints } = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * The status of this presence:\n *\n * * **`online`** - user is online\n * * **`idle`** - user is AFK\n * * **`offline`** - user is offline or invisible\n * * **`dnd`** - user is in Do Not Disturb\n * @typedef {string} PresenceStatus\n */\n\n/**\n * Represents a user's presence.\n */\nclass Presence {\n constructor(data = {}, client) {\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The status of this presence:\n * @type {PresenceStatus}\n */\n this.status = data.status || 'offline';\n\n /**\n * The game that the user is playing\n * @type {?Game}\n */\n this.game = data.game ? new Game(data.game, this) : null;\n\n /**\n * The devices this presence is on\n * @type {?object}\n * @property {PresenceStatus} web\n * @property {PresenceStatus} mobile\n * @property {PresenceStatus} desktop\n */\n this.clientStatus = data.client_status || null;\n }\n\n update(data) {\n this.status = data.status || this.status;\n this.game = data.game ? new Game(data.game, this) : null;\n this.clientStatus = data.client_status || null;\n }\n\n /**\n * Whether this presence is equal to another\n * @param {Presence} presence The presence to compare with\n * @returns {boolean}\n */\n equals(presence) {\n return this === presence || (\n presence &&\n this.status === presence.status &&\n (this.game ? this.game.equals(presence.game) : !presence.game) &&\n this.clientStatus.web === presence.clientStatus.web &&\n this.clientStatus.mobile === presence.clientStatus.mobile &&\n this.clientStatus.desktop === presence.clientStatus.desktop\n );\n }\n}\n\n/**\n * Represents a game that is part of a user's presence.\n */\nclass Game {\n constructor(data, presence) {\n Object.defineProperty(this, 'presence', { value: presence });\n\n /**\n * The name of the game being played\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The type of the game status, its possible values:\n * - 0: Playing\n * - 1: Streaming\n * - 2: Listening\n * - 3: Watching\n * @type {number}\n */\n this.type = data.type;\n\n /**\n * If the game is being streamed, a link to the stream\n * @type {?string}\n */\n this.url = data.url || null;\n\n /**\n * Details about the activity\n * @type {?string}\n */\n this.details = data.details || null;\n\n /**\n * State of the activity\n * @type {?string}\n */\n this.state = data.state || null;\n\n /**\n * Application ID associated with this activity\n * @type {?Snowflake}\n */\n this.applicationID = data.application_id || null;\n\n /**\n * Timestamps for the activity\n * @type {?Object}\n * @prop {?Date} start When the activity started\n * @prop {?Date} end When the activity will end\n */\n this.timestamps = data.timestamps ? {\n start: data.timestamps.start ? new Date(Number(data.timestamps.start)) : null,\n end: data.timestamps.end ? new Date(Number(data.timestamps.end)) : null,\n } : null;\n\n /**\n * Party of the activity\n * @type {?Object}\n * @prop {?string} id ID of the party\n * @prop {number[]} size Size of the party as `[current, max]`\n */\n this.party = data.party || null;\n\n /**\n * Assets for rich presence\n * @type {?RichPresenceAssets}\n */\n this.assets = data.assets ? new RichPresenceAssets(this, data.assets) : null;\n\n this.syncID = data.sync_id;\n this._flags = data.flags;\n }\n\n get flags() {\n const flags = [];\n for (const [name, flag] of Object.entries(ActivityFlags)) {\n if ((this._flags & flag) === flag) flags.push(name);\n }\n return flags;\n }\n\n /**\n * Whether or not the game is being streamed\n * @type {boolean}\n * @readonly\n */\n get streaming() {\n return this.type === 1;\n }\n\n /**\n * When concatenated with a string, this automatically returns the game's name instead of the Game object.\n * @returns {string}\n */\n toString() {\n return this.name;\n }\n\n /**\n * Whether this game is equal to another game\n * @param {Game} game The game to compare with\n * @returns {boolean}\n */\n equals(game) {\n return this === game || (\n game &&\n this.name === game.name &&\n this.type === game.type &&\n this.url === game.url\n );\n }\n}\n\n/**\n * Assets for a rich presence\n */\nclass RichPresenceAssets {\n constructor(game, assets) {\n Object.defineProperty(this, 'game', { value: game });\n\n /**\n * Hover text for the large image\n * @type {?string}\n */\n this.largeText = assets.large_text || null;\n\n /**\n * Hover text for the small image\n * @type {?string}\n */\n this.smallText = assets.small_text || null;\n\n /**\n * ID of the large image asset\n * @type {?Snowflake}\n */\n this.largeImage = assets.large_image || null;\n\n /**\n * ID of the small image asset\n * @type {?Snowflake}\n */\n this.smallImage = assets.small_image || null;\n }\n\n /**\n * The URL of the small image asset\n * @type {?string}\n * @readonly\n */\n get smallImageURL() {\n if (!this.smallImage) return null;\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.smallImage);\n }\n\n /**\n * The URL of the large image asset\n * @type {?string}\n * @readonly\n */\n get largeImageURL() {\n if (!this.largeImage) return null;\n if (/^spotify:/.test(this.largeImage)) {\n return `https://i.scdn.co/image/${this.largeImage.slice(8)}`;\n }\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.largeImage);\n }\n}\n\nexports.Presence = Presence;\nexports.Game = Game;\nexports.RichPresenceAssets = RichPresenceAssets;\n\n\n//# sourceURL=webpack:///./src/structures/Presence.js?"); +eval("const { ActivityFlags, Endpoints } = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * The status of this presence:\n * * **`online`** - user is online\n * * **`idle`** - user is AFK\n * * **`offline`** - user is offline or invisible\n * * **`dnd`** - user is in Do Not Disturb\n * @typedef {string} PresenceStatus\n */\n\n/**\n * The status of this presence:\n * * **`online`** - user is online\n * * **`idle`** - user is AFK\n * * **`dnd`** - user is in Do Not Disturb\n * @typedef {string} ClientPresenceStatus\n */\n\n/**\n * Represents a user's presence.\n */\nclass Presence {\n constructor(data = {}, client) {\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The status of this presence:\n * @type {PresenceStatus}\n */\n this.status = data.status || 'offline';\n\n /**\n * The game that the user is playing\n * @type {?Game}\n */\n this.game = data.game ? new Game(data.game, this) : null;\n\n /**\n * The devices this presence is on\n * @type {?Object}\n * @property {?ClientPresenceStatus} web The current presence in the web application\n * @property {?ClientPresenceStatus} mobile The current presence in the mobile application\n * @property {?ClientPresenceStatus} desktop The current presence in the desktop application\n */\n this.clientStatus = data.client_status || null;\n }\n\n update(data) {\n this.status = data.status || this.status;\n this.game = data.game ? new Game(data.game, this) : null;\n this.clientStatus = data.client_status || null;\n }\n\n /**\n * Whether this presence is equal to another\n * @param {Presence} presence The presence to compare with\n * @returns {boolean}\n */\n equals(presence) {\n return this === presence || (\n presence &&\n this.status === presence.status &&\n (this.game ? this.game.equals(presence.game) : !presence.game) &&\n this.clientStatus.web === presence.clientStatus.web &&\n this.clientStatus.mobile === presence.clientStatus.mobile &&\n this.clientStatus.desktop === presence.clientStatus.desktop\n );\n }\n}\n\n/**\n * Represents a game that is part of a user's presence.\n */\nclass Game {\n constructor(data, presence) {\n Object.defineProperty(this, 'presence', { value: presence });\n\n /**\n * The name of the game being played\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The type of the game status, its possible values:\n * - 0: Playing\n * - 1: Streaming\n * - 2: Listening\n * - 3: Watching\n * @type {number}\n */\n this.type = data.type;\n\n /**\n * If the game is being streamed, a link to the stream\n * @type {?string}\n */\n this.url = data.url || null;\n\n /**\n * Details about the activity\n * @type {?string}\n */\n this.details = data.details || null;\n\n /**\n * State of the activity\n * @type {?string}\n */\n this.state = data.state || null;\n\n /**\n * Application ID associated with this activity\n * @type {?Snowflake}\n */\n this.applicationID = data.application_id || null;\n\n /**\n * Timestamps for the activity\n * @type {?Object}\n * @prop {?Date} start When the activity started\n * @prop {?Date} end When the activity will end\n */\n this.timestamps = data.timestamps ? {\n start: data.timestamps.start ? new Date(Number(data.timestamps.start)) : null,\n end: data.timestamps.end ? new Date(Number(data.timestamps.end)) : null,\n } : null;\n\n /**\n * Party of the activity\n * @type {?Object}\n * @prop {?string} id ID of the party\n * @prop {number[]} size Size of the party as `[current, max]`\n */\n this.party = data.party || null;\n\n /**\n * Assets for rich presence\n * @type {?RichPresenceAssets}\n */\n this.assets = data.assets ? new RichPresenceAssets(this, data.assets) : null;\n\n this.syncID = data.sync_id;\n this._flags = data.flags;\n }\n\n get flags() {\n const flags = [];\n for (const [name, flag] of Object.entries(ActivityFlags)) {\n if ((this._flags & flag) === flag) flags.push(name);\n }\n return flags;\n }\n\n /**\n * Whether or not the game is being streamed\n * @type {boolean}\n * @readonly\n */\n get streaming() {\n return this.type === 1;\n }\n\n /**\n * When concatenated with a string, this automatically returns the game's name instead of the Game object.\n * @returns {string}\n */\n toString() {\n return this.name;\n }\n\n /**\n * Whether this game is equal to another game\n * @param {Game} game The game to compare with\n * @returns {boolean}\n */\n equals(game) {\n return this === game || (\n game &&\n this.name === game.name &&\n this.type === game.type &&\n this.url === game.url\n );\n }\n}\n\n/**\n * Assets for a rich presence\n */\nclass RichPresenceAssets {\n constructor(game, assets) {\n Object.defineProperty(this, 'game', { value: game });\n\n /**\n * Hover text for the large image\n * @type {?string}\n */\n this.largeText = assets.large_text || null;\n\n /**\n * Hover text for the small image\n * @type {?string}\n */\n this.smallText = assets.small_text || null;\n\n /**\n * ID of the large image asset\n * @type {?Snowflake}\n */\n this.largeImage = assets.large_image || null;\n\n /**\n * ID of the small image asset\n * @type {?Snowflake}\n */\n this.smallImage = assets.small_image || null;\n }\n\n /**\n * The URL of the small image asset\n * @type {?string}\n * @readonly\n */\n get smallImageURL() {\n if (!this.smallImage) return null;\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.smallImage);\n }\n\n /**\n * The URL of the large image asset\n * @type {?string}\n * @readonly\n */\n get largeImageURL() {\n if (!this.largeImage) return null;\n if (/^spotify:/.test(this.largeImage)) {\n return `https://i.scdn.co/image/${this.largeImage.slice(8)}`;\n }\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.largeImage);\n }\n}\n\nexports.Presence = Presence;\nexports.Game = Game;\nexports.RichPresenceAssets = RichPresenceAssets;\n\n\n//# sourceURL=webpack:///./src/structures/Presence.js?"); /***/ }),