Class: Discordrb::Integration
- Inherits:
-
Object
- Object
- Discordrb::Integration
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data.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.
-
#role ⇒ Role?
readonly
The role that this integration uses for "subscribers".
-
#server ⇒ Server
readonly
The server the integration is linked to.
-
#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.
2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 |
# File 'lib/discordrb/data.rb', line 2822 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 = server.role(data['role_id']) || nil @emoticon = data['enable_emoticons'] end |
Instance Attribute Details
#account ⇒ IntegrationAccount (readonly)
Returns the integration account information.
2810 2811 2812 |
# File 'lib/discordrb/data.rb', line 2810 def account @account end |
#emoticon ⇒ true, false (readonly) Also known as: emoticon?
Returns whether emoticons are enabled.
2797 2798 2799 |
# File 'lib/discordrb/data.rb', line 2797 def emoticon @emoticon end |
#enabled ⇒ true, false (readonly)
Returns whether the integration is enabled.
2804 2805 2806 |
# File 'lib/discordrb/data.rb', line 2804 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).
2816 2817 2818 |
# File 'lib/discordrb/data.rb', line 2816 def expire_behaviour @expire_behaviour end |
#expire_grace_period ⇒ Integer (readonly)
Returns the grace period before subscribers expire (in days).
2820 2821 2822 |
# File 'lib/discordrb/data.rb', line 2820 def expire_grace_period @expire_grace_period end |
#name ⇒ String (readonly)
Returns the integration name.
2785 2786 2787 |
# File 'lib/discordrb/data.rb', line 2785 def name @name end |
#role ⇒ Role? (readonly)
Returns the role that this integration uses for "subscribers".
2794 2795 2796 |
# File 'lib/discordrb/data.rb', line 2794 def role @role end |
#server ⇒ Server (readonly)
Returns the server the integration is linked to.
2788 2789 2790 |
# File 'lib/discordrb/data.rb', line 2788 def server @server end |
#synced_at ⇒ Time (readonly)
Returns the time the integration was synced at.
2813 2814 2815 |
# File 'lib/discordrb/data.rb', line 2813 def synced_at @synced_at end |
#syncing ⇒ true, false (readonly)
Returns whether the integration is syncing.
2807 2808 2809 |
# File 'lib/discordrb/data.rb', line 2807 def syncing @syncing end |
#type ⇒ String (readonly)
Returns the integration type (YouTube, Twitch, etc.).
2801 2802 2803 |
# File 'lib/discordrb/data.rb', line 2801 def type @type end |
#user ⇒ User (readonly)
Returns the user the integration is linked to.
2791 2792 2793 |
# File 'lib/discordrb/data.rb', line 2791 def user @user end |
Instance Method Details
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
2841 2842 2843 |
# File 'lib/discordrb/data.rb', line 2841 def inspect "<Integration name=#{@name} id=#{@id} type=#{@type} enabled=#{@enabled}>" end |