class Discorb::Integration
Represents a integration.
Attributes
@!visibility private
@return [Discorb::Integration::Account] The account for the integration.
@return [Discorb::Application] The application for the integration.
@return [Boolean] Whether the integration is enabled emoticons.
@return [Boolean] Whether the integration is enabled emoticons.
@return [Boolean] Whether the integration is enabled.
@return [Boolean] Whether the integration is enabled.
@return [:remove_role, :kick] The behavior of the integration when it expires.
@return [Integer] The grace period of the integration.
@return [Discorb::Snowflake] The ID of the integration.
@return [Boolean] Whether the integration is revoked.
@return [Boolean] Whether the integration is revoked.
@return [Integer] The number of subscribers for the integration.
@return [Boolean] Whether the integration is syncing.
@return [Boolean] Whether the integration is syncing.
@return [Symbol] The type of integration.
@return [Discorb::User] The user for the integration.
Public Class Methods
@!visibility private
# File lib/discorb/integration.rb, line 47 def initialize(client, data, guild_id, no_cache: false) @client = client @data = data @guild_id = guild_id _set_data(data) guild.integrations[@id] = self unless no_cache end
Public Instance Methods
Delete the integration.
@param [String] reason The reason for deleting the integration.
# File lib/discorb/integration.rb, line 64 def delete!(reason: nil) Async do @client.http.delete("/guilds/#{@guild}/integrations/#{@id}", reason: reason).wait end end
# File lib/discorb/integration.rb, line 55 def guild @client.guilds[@guild_id] end
Private Instance Methods
# File lib/discorb/integration.rb, line 74 def _set_data(data) @id = Snowflake.new(data[:id]) @type = data[:type].to_sym @enabled = data[:enabled] @syncing = data[:syncing] @role_id = Snowflake.new(data[:role_id]) @enable_emoticons = data[:enable_emoticons] @expire_behavior = self.class.expire_behavior[data[:expire_behavior]] @expire_grace_period = data[:expire_grace_period] @user = client.users[data[:user].to_i] @account = Account.new(data[:account]) @subscriber_count = data[:subscriber_count] @revoked = data[:revoked] @application = Application.new(@client, data[:application]) end