Class: Discordrb::Integration
- Inherits:
-
Object
- Object
- Discordrb::Integration
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data/integration.rb
Overview
Server integration
Instance Attribute Summary collapse
-
#account ⇒ IntegrationAccount
readonly
The integration account information.
-
#emoticon ⇒ true, false
(also: #emoticon?)
readonly
Whether emoticons are enabled.
-
#enabled ⇒ true, false
readonly
Whether the integration is enabled.
-
#expire_behaviour ⇒ Symbol
(also: #expire_behavior)
readonly
The behaviour of expiring subscribers (:remove = Remove User from role; :kick = Kick User from server).
-
#expire_grace_period ⇒ Integer
readonly
The grace period before subscribers expire (in days).
-
#name ⇒ String
readonly
The integration name.
-
#revoked ⇒ true, false
readonly
Has this integration been revoked.
-
#role_id ⇒ Integer?
readonly
The role that this integration uses for “subscribers”.
-
#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 synced at.
-
#syncing ⇒ true, false
readonly
Whether the integration is syncing.
-
#type ⇒ String
readonly
The integration type (YouTube, Twitch, etc.).
-
#user ⇒ User
readonly
The user the integration is linked to.
Attributes included from IDObject
Instance Method Summary collapse
-
#initialize(data, bot, server) ⇒ Integration
constructor
A new instance of Integration.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
Methods included from IDObject
#==, #creation_time, synthesise
Constructor Details
#initialize(data, bot, server) ⇒ Integration
Returns a new instance of Integration.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/discordrb/data/integration.rb', line 96 def initialize(data, bot, server) @bot = bot @name = data['name'] @server = server @id = data['id'].to_i @enabled = data['enabled'] @syncing = data['syncing'] @type = data['type'] @account = IntegrationAccount.new(data['account']) @synced_at = Time.parse(data['synced_at']) @expire_behaviour = %i[remove kick][data['expire_behavior']] @expire_grace_period = data['expire_grace_period'] @user = @bot.ensure_user(data['user']) @role_id = data['role_id']&.to_i @emoticon = data['enable_emoticons'] @subscriber_count = data['subscriber_count']&.to_i @revoked = data['revoked'] @application = IntegrationApplication.new(data['application'], bot) if data['application'] end |
Instance Attribute Details
#account ⇒ IntegrationAccount (readonly)
Returns the integration account information.
78 79 80 |
# File 'lib/discordrb/data/integration.rb', line 78 def account @account end |
#emoticon ⇒ true, false (readonly) Also known as: emoticon?
Returns whether emoticons are enabled.
65 66 67 |
# File 'lib/discordrb/data/integration.rb', line 65 def emoticon @emoticon end |
#enabled ⇒ true, false (readonly)
Returns whether the integration is enabled.
72 73 74 |
# File 'lib/discordrb/data/integration.rb', line 72 def enabled @enabled end |
#expire_behaviour ⇒ Symbol (readonly) Also known as: expire_behavior
Returns the behaviour of expiring subscribers (:remove = Remove User from role; :kick = Kick User from server).
84 85 86 |
# File 'lib/discordrb/data/integration.rb', line 84 def expire_behaviour @expire_behaviour end |
#expire_grace_period ⇒ Integer (readonly)
Returns the grace period before subscribers expire (in days).
88 89 90 |
# File 'lib/discordrb/data/integration.rb', line 88 def expire_grace_period @expire_grace_period end |
#name ⇒ String (readonly)
Returns the integration name.
53 54 55 |
# File 'lib/discordrb/data/integration.rb', line 53 def name @name end |
#revoked ⇒ true, false (readonly)
Returns has this integration been revoked.
94 95 96 |
# File 'lib/discordrb/data/integration.rb', line 94 def revoked @revoked end |
#role_id ⇒ Integer? (readonly)
Returns the role that this integration uses for “subscribers”.
62 63 64 |
# File 'lib/discordrb/data/integration.rb', line 62 def role_id @role_id end |
#server ⇒ Server (readonly)
Returns the server the integration is linked to.
56 57 58 |
# File 'lib/discordrb/data/integration.rb', line 56 def server @server end |
#subscriber_count ⇒ Integer? (readonly)
Returns how many subscribers this integration has.
91 92 93 |
# File 'lib/discordrb/data/integration.rb', line 91 def subscriber_count @subscriber_count end |
#synced_at ⇒ Time (readonly)
Returns the time the integration was synced at.
81 82 83 |
# File 'lib/discordrb/data/integration.rb', line 81 def synced_at @synced_at end |
#syncing ⇒ true, false (readonly)
Returns whether the integration is syncing.
75 76 77 |
# File 'lib/discordrb/data/integration.rb', line 75 def syncing @syncing end |
#type ⇒ String (readonly)
Returns the integration type (YouTube, Twitch, etc.).
69 70 71 |
# File 'lib/discordrb/data/integration.rb', line 69 def type @type end |
#user ⇒ User (readonly)
Returns the user the integration is linked to.
59 60 61 |
# File 'lib/discordrb/data/integration.rb', line 59 def user @user end |
Instance Method Details
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
118 119 120 |
# File 'lib/discordrb/data/integration.rb', line 118 def inspect "<Integration name=#{@name} id=#{@id} type=#{@type} enabled=#{@enabled}>" end |