Class: Discorb::Integration

Inherits:
DiscordModel show all
Defined in:
lib/discorb/integration.rb

Overview

Represents a integration.

Defined Under Namespace

Classes: Account, Application

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?, #inspect

Instance Attribute Details

#account -> Discorb::Integration::Account (readonly)

Returns The account for the integration.

Returns:



28
29
30
# File 'lib/discorb/integration.rb', line 28

def 
  @account
end

#application -> Discorb::Application (readonly)

Returns The application for the integration.

Returns:



35
36
37
# File 'lib/discorb/integration.rb', line 35

def application
  @application
end

#enable_emoticons -> Boolean (readonly) Also known as: enable_emoticons?

Returns Whether the integration is enabled emoticons.

Returns:

  • (Boolean)

    Whether the integration is enabled emoticons.



19
20
21
# File 'lib/discorb/integration.rb', line 19

def enable_emoticons
  @enable_emoticons
end

#enabled -> Boolean (readonly) Also known as: enabled?

Returns Whether the integration is enabled.

Returns:

  • (Boolean)

    Whether the integration is enabled.



13
14
15
# File 'lib/discorb/integration.rb', line 13

def enabled
  @enabled
end

#expire_behavior -> :remove_role, :kick (readonly)

Returns The behavior of the integration when it expires.

Returns:

  • (:remove_role, :kick)

    The behavior of the integration when it expires.



22
23
24
# File 'lib/discorb/integration.rb', line 22

def expire_behavior
  @expire_behavior
end

#expire_grace_period -> Integer (readonly)

Returns The grace period of the integration.

Returns:

  • (Integer)

    The grace period of the integration.



24
25
26
# File 'lib/discorb/integration.rb', line 24

def expire_grace_period
  @expire_grace_period
end

#guild -> nil, Discorb::Guild (readonly)

Note:

This method returns an object from client cache. it will return nil if the object is not in cache.

Returns:

  • (nil)

    The object wasn't cached.

  • (Discorb::Guild)

    The guild this integration is in.



# File 'lib/discorb/integration.rb', line 37

#id -> Discorb::Snowflake (readonly)

Returns The ID of the integration.

Returns:



9
10
11
# File 'lib/discorb/integration.rb', line 9

def id
  @id
end

#revoked -> Boolean (readonly) Also known as: revoked?

Returns Whether the integration is revoked.

Returns:

  • (Boolean)

    Whether the integration is revoked.



32
33
34
# File 'lib/discorb/integration.rb', line 32

def revoked
  @revoked
end

#subscriber_count -> Integer (readonly)

Returns The number of subscribers for the integration.

Returns:

  • (Integer)

    The number of subscribers for the integration.



30
31
32
# File 'lib/discorb/integration.rb', line 30

def subscriber_count
  @subscriber_count
end

#syncing -> Boolean (readonly) Also known as: syncing?

Returns Whether the integration is syncing.

Returns:

  • (Boolean)

    Whether the integration is syncing.



16
17
18
# File 'lib/discorb/integration.rb', line 16

def syncing
  @syncing
end

#type -> Symbol (readonly)

Returns The type of integration.

Returns:

  • (Symbol)

    The type of integration.



11
12
13
# File 'lib/discorb/integration.rb', line 11

def type
  @type
end

#user -> Discorb::User (readonly)

Returns The user for the integration.

Returns:



26
27
28
# File 'lib/discorb/integration.rb', line 26

def user
  @user
end

Instance Method Details

#delete!(reason: nil) -> Async::Task<void> Also known as: destroy!

Delete the integration.

Parameters:

  • reason (String) (defaults to: nil)

    The reason for deleting the integration.

Returns:

  • (Async::Task<void>)

    The task.



75
76
77
78
79
80
81
82
# File 'lib/discorb/integration.rb', line 75

def delete!(reason: nil)
  Async do
    @client.http.request(
      Route.new("/guilds/#{@guild}/integrations/#{@id}", "//guilds/:guild_id/integrations/:integration_id",
                :delete), {}, audit_log_reason: reason
    ).wait
  end
end