Class: Discordrb::Integration

Inherits:
Object
  • Object
show all
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

Attributes included from IDObject

#id

Instance Method Summary collapse

Methods included from IDObject

#==, #creation_time, synthesise

Instance Attribute Details

#accountIntegrationAccount (readonly)

Returns the integration account information.

Returns:



84
85
86
# File 'lib/discordrb/data/integration.rb', line 84

def 
  @account
end

#applicationIntegrationApplication? (readonly)

Returns the application for the integration.

Returns:



106
107
108
# File 'lib/discordrb/data/integration.rb', line 106

def application
  @application
end

#emoticontrue, false (readonly) Also known as: emoticon?, emoticons?

Returns whether or not emoticons are enabled.

Returns:

  • (true, false)

    whether or not emoticons are enabled



68
69
70
# File 'lib/discordrb/data/integration.rb', line 68

def emoticon
  @emoticon
end

#enabledtrue, false (readonly) Also known as: enabled?

Returns whether the integration is enabled.

Returns:

  • (true, false)

    whether the integration is enabled



76
77
78
# File 'lib/discordrb/data/integration.rb', line 76

def enabled
  @enabled
end

#expire_behaviourSymbol? (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.

Returns:

  • (Symbol, nil)

    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_periodInteger (readonly)

Returns the grace period before subscribers expire (in days).

Returns:

  • (Integer)

    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

#nameString (readonly)

Returns the integration name.

Returns:

  • (String)

    the integration name



55
56
57
# File 'lib/discordrb/data/integration.rb', line 55

def name
  @name
end

#revokedtrue, false (readonly) Also known as: revoked?

Returns whether or not this integration been revoked.

Returns:

  • (true, false)

    whether or not this integration been revoked.



102
103
104
# File 'lib/discordrb/data/integration.rb', line 102

def revoked
  @revoked
end

#role_idInteger? (readonly)

Returns the ID of the role that this integration uses for "subscribers".

Returns:

  • (Integer, nil)

    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

#scopesArray<String> (readonly)

Returns the oauth2 scopes the application has been authorized for.

Returns:

  • (Array<String>)

    the oauth2 scopes the application has been authorized for



109
110
111
# File 'lib/discordrb/data/integration.rb', line 109

def scopes
  @scopes
end

#serverServer (readonly)

Returns the server the integration is linked to.

Returns:

  • (Server)

    the server the integration is linked to



58
59
60
# File 'lib/discordrb/data/integration.rb', line 58

def server
  @server
end

#subscriber_countInteger? (readonly)

Returns how many subscribers this integration has.

Returns:

  • (Integer, nil)

    how many subscribers this integration has.



99
100
101
# File 'lib/discordrb/data/integration.rb', line 99

def subscriber_count
  @subscriber_count
end

#synced_atTime? (readonly)

Returns the time the integration was last synced at.

Returns:

  • (Time, nil)

    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

#syncingtrue, false (readonly) Also known as: syncing?

Returns whether or not the integration is syncing.

Returns:

  • (true, false)

    whether or not the integration is syncing



80
81
82
# File 'lib/discordrb/data/integration.rb', line 80

def syncing
  @syncing
end

#typeString (readonly)

Returns the integration type (YouTube, Twitch, Discord, etc.).

Returns:

  • (String)

    the integration type (YouTube, Twitch, Discord, etc.)



73
74
75
# File 'lib/discordrb/data/integration.rb', line 73

def type
  @type
end

#userUser? (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.

Returns:

  • (User, nil)

    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

#inspectObject

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_roleRole?

Get the role that this integration uses for subscribers.

Returns:

  • (Role, nil)

    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