Class: Discordrb::Integration
- Inherits:
-
Object
- Object
- Discordrb::Integration
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data/integration.rb
Overview
Server integration
Constant Summary collapse
- EXPIRE_BEHAVIORS =
Map of expire behaviors.
{ remove: 0, kick: 1 }.freeze
Instance Attribute Summary collapse
-
#account ⇒ IntegrationAccount
readonly
The integration account information.
-
#application ⇒ IntegrationApplication?
readonly
The application for the integration.
-
#emoticon ⇒ true, false
(also: #emoticon?, #emoticons?)
readonly
Whether or not emoticons are enabled.
-
#enabled ⇒ true, false
(also: #enabled?)
readonly
Whether the integration is enabled.
-
#expire_behaviour ⇒ Symbol?
(also: #expire_behavior)
readonly
The behaviour of expiring subscribers.
-
#expire_grace_period ⇒ Integer
readonly
The grace period before subscribers expire (in days).
-
#name ⇒ String
readonly
The integration name.
-
#revoked ⇒ true, false
(also: #revoked?)
readonly
Whether or not this integration been revoked.
-
#role_id ⇒ Integer?
readonly
The ID of the role that this integration uses for "subscribers".
-
#scopes ⇒ Array<String>
readonly
The oauth2 scopes the application has been authorized for.
-
#server ⇒ Server
readonly
The server the integration is linked to.
-
#subscriber_count ⇒ Integer?
readonly
How many subscribers this integration has.
-
#synced_at ⇒ Time?
readonly
The time the integration was last synced at.
-
#syncing ⇒ true, false
(also: #syncing?)
readonly
Whether or not the integration is syncing.
-
#type ⇒ String
readonly
The integration type (YouTube, Twitch, Discord, etc.).
-
#user ⇒ User?
readonly
The user who added the integration to the server.
Attributes included from IDObject
Instance Method Summary collapse
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
-
#subscriber_role ⇒ Role?
Get the role that this integration uses for subscribers.
Methods included from IDObject
#==, #creation_time, synthesise
Instance Attribute Details
#account ⇒ IntegrationAccount (readonly)
Returns the integration account information.
84 85 86 |
# File 'lib/discordrb/data/integration.rb', line 84 def account @account end |
#application ⇒ IntegrationApplication? (readonly)
Returns the application for the integration.
106 107 108 |
# File 'lib/discordrb/data/integration.rb', line 106 def application @application end |
#emoticon ⇒ true, false (readonly) Also known as: emoticon?, emoticons?
Returns whether or not emoticons are enabled.
68 69 70 |
# File 'lib/discordrb/data/integration.rb', line 68 def emoticon @emoticon end |
#enabled ⇒ true, false (readonly) Also known as: enabled?
Returns whether the integration is enabled.
76 77 78 |
# File 'lib/discordrb/data/integration.rb', line 76 def enabled @enabled end |
#expire_behaviour ⇒ Symbol? (readonly) Also known as: expire_behavior
Returns the behaviour of expiring subscribers. When this is :remove, the
associated role will be removed from the user. When this is :kick, the user will be
kicked out of the server.
92 93 94 |
# File 'lib/discordrb/data/integration.rb', line 92 def expire_behaviour @expire_behaviour end |
#expire_grace_period ⇒ Integer (readonly)
Returns the grace period before subscribers expire (in days).
96 97 98 |
# File 'lib/discordrb/data/integration.rb', line 96 def expire_grace_period @expire_grace_period end |
#name ⇒ String (readonly)
Returns the integration name.
55 56 57 |
# File 'lib/discordrb/data/integration.rb', line 55 def name @name end |
#revoked ⇒ true, false (readonly) Also known as: revoked?
Returns whether or not this integration been revoked.
102 103 104 |
# File 'lib/discordrb/data/integration.rb', line 102 def revoked @revoked end |
#role_id ⇒ Integer? (readonly)
Returns the ID of the role that this integration uses for "subscribers".
65 66 67 |
# File 'lib/discordrb/data/integration.rb', line 65 def role_id @role_id end |
#scopes ⇒ Array<String> (readonly)
Returns the oauth2 scopes the application has been authorized for.
109 110 111 |
# File 'lib/discordrb/data/integration.rb', line 109 def scopes @scopes end |
#server ⇒ Server (readonly)
Returns the server the integration is linked to.
58 59 60 |
# File 'lib/discordrb/data/integration.rb', line 58 def server @server end |
#subscriber_count ⇒ Integer? (readonly)
Returns how many subscribers this integration has.
99 100 101 |
# File 'lib/discordrb/data/integration.rb', line 99 def subscriber_count @subscriber_count end |
#synced_at ⇒ Time? (readonly)
Returns the time the integration was last synced at.
87 88 89 |
# File 'lib/discordrb/data/integration.rb', line 87 def synced_at @synced_at end |
#syncing ⇒ true, false (readonly) Also known as: syncing?
Returns whether or not the integration is syncing.
80 81 82 |
# File 'lib/discordrb/data/integration.rb', line 80 def syncing @syncing end |
#type ⇒ String (readonly)
Returns the integration type (YouTube, Twitch, Discord, etc.).
73 74 75 |
# File 'lib/discordrb/data/integration.rb', line 73 def type @type end |
#user ⇒ User? (readonly)
Returns the user who added the integration to the server. This will be nil
for very old integrations, or if the integration was sent via a Gateway event.
62 63 64 |
# File 'lib/discordrb/data/integration.rb', line 62 def user @user end |
Instance Method Details
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
140 141 142 |
# File 'lib/discordrb/data/integration.rb', line 140 def inspect "<Integration name=\"#{@name}\" id=#{@id} type=\"#{@type}\" enabled=#{@enabled}>" end |
#subscriber_role ⇒ Role?
Get the role that this integration uses for subscribers.
135 136 137 |
# File 'lib/discordrb/data/integration.rb', line 135 def subscriber_role @server.role(@role_id) if @role_id end |