diff options
| author | 8cy <[email protected]> | 2020-04-03 02:48:28 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-03 02:48:28 -0700 |
| commit | f9159ea2d994e14180fb02ab562f0119513e67cf (patch) | |
| tree | 09d14cdf05456567156738b681379d4bccd64e5c /node_modules/discord.js/src/structures/Integration.js | |
| parent | 2020/04/03, 02:42, V1.2.1 (diff) | |
| download | s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.tar.xz s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.zip | |
2020/04/03, 02:47, V1.2.2
Diffstat (limited to 'node_modules/discord.js/src/structures/Integration.js')
| -rw-r--r-- | node_modules/discord.js/src/structures/Integration.js | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/node_modules/discord.js/src/structures/Integration.js b/node_modules/discord.js/src/structures/Integration.js deleted file mode 100644 index 96af017..0000000 --- a/node_modules/discord.js/src/structures/Integration.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * The information account for an integration - * @typedef {Object} IntegrationAccount - * @property {string} id The id of the account - * @property {string} name The name of the account - */ - -/** - * Represents a guild integration. - */ -class Integration { - constructor(client, data, guild) { - /** - * The client that created this integration - * @name Integration#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - - /** - * The guild this integration belongs to - * @type {Guild} - */ - this.guild = guild; - - /** - * The integration id - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The integration name - * @type {string} - */ - this.name = data.name; - /** - * The integration type (twitch, youtube, etc) - * @type {string} - */ - this.type = data.type; - - /** - * Whether this integration is enabled - * @type {boolean} - */ - this.enabled = data.enabled; - - /** - * Whether this integration is syncing - * @type {boolean} - */ - this.syncing = data.syncing; - - /** - * The role that this integration uses for subscribers - * @type {Role} - */ - this.role = this.guild.roles.get(data.role_id); - - /** - * The user for this integration - * @type {User} - */ - this.user = this.client.dataManager.newUser(data.user); - - /** - * The account integration information - * @type {IntegrationAccount} - */ - this.account = data.account; - - /** - * The last time this integration was last synced - * @type {number} - */ - this.syncedAt = data.synced_at; - this._patch(data); - } - - _patch(data) { - /** - * The behavior of expiring subscribers - * @type {number} - */ - this.expireBehavior = data.expire_behavior; - - /** - * The grace period before expiring subscribers - * @type {number} - */ - this.expireGracePeriod = data.expire_grace_period; - } - - /** - * Syncs this integration - * @returns {Promise<Integration>} - */ - sync() { - this.syncing = true; - return this.client.rest.methods.syncIntegration(this) - .then(() => { - this.syncing = false; - this.syncedAt = Date.now(); - return this; - }); - } - - /** - * The data for editing an integration. - * @typedef {Object} IntegrationEditData - * @property {number} [expireBehavior] The new behaviour of expiring subscribers - * @property {number} [expireGracePeriod] The new grace period before expiring subscribers - */ - - /** - * Edits this integration. - * @param {IntegrationEditData} data The data to edit this integration with - * @param {string} reason Reason for editing this integration - * @returns {Promise<Integration>} - */ - edit(data, reason) { - if ('expireBehavior' in data) { - data.expire_behavior = data.expireBehavior; - data.expireBehavior = undefined; - } - if ('expireGracePeriod' in data) { - data.expire_grace_period = data.expireGracePeriod; - data.expireGracePeriod = undefined; - } - // The option enable_emoticons is only available for Twitch at this moment - return this.client.rest.methods.editIntegration(this, data, reason) - .then(() => { - this._patch(data); - return this; - }); - } - - /** - * Deletes this integration. - * @returns {Promise<Integration>} - * @param {string} [reason] Reason for deleting this integration - */ - delete(reason) { - return this.client.rest.methods.deleteIntegration(this, reason) - .then(() => this); - } -} - -module.exports = Integration; |