Class: Discordrb::Integration

Inherits:
Object
  • Object
show all
Includes:
IDObject
Defined in:
lib/discordrb/data.rb

Overview

Server integration

Instance Attribute Summary collapse

Attributes included from IDObject

#id

Instance Method Summary collapse

Methods included from IDObject

#==, #creation_time, synthesise

Constructor Details

#initialize(data, bot, server) ⇒ Integration



2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
# File 'lib/discordrb/data.rb', line 2174

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 = [: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

#accountIntegrationAccount (readonly)



2162
2163
2164
# File 'lib/discordrb/data.rb', line 2162

def 
  @account
end

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



2149
2150
2151
# File 'lib/discordrb/data.rb', line 2149

def emoticon
  @emoticon
end

#enabledtrue, false (readonly)



2156
2157
2158
# File 'lib/discordrb/data.rb', line 2156

def enabled
  @enabled
end

#expire_behaviourSymbol (readonly) Also known as: expire_behavior



2168
2169
2170
# File 'lib/discordrb/data.rb', line 2168

def expire_behaviour
  @expire_behaviour
end

#expire_grace_periodInteger (readonly)



2172
2173
2174
# File 'lib/discordrb/data.rb', line 2172

def expire_grace_period
  @expire_grace_period
end

#nameString (readonly)



2137
2138
2139
# File 'lib/discordrb/data.rb', line 2137

def name
  @name
end

#roleRole? (readonly)



2146
2147
2148
# File 'lib/discordrb/data.rb', line 2146

def role
  @role
end

#serverServer (readonly)



2140
2141
2142
# File 'lib/discordrb/data.rb', line 2140

def server
  @server
end

#synced_atTime (readonly)



2165
2166
2167
# File 'lib/discordrb/data.rb', line 2165

def synced_at
  @synced_at
end

#syncingtrue, false (readonly)



2159
2160
2161
# File 'lib/discordrb/data.rb', line 2159

def syncing
  @syncing
end

#typeString (readonly)



2153
2154
2155
# File 'lib/discordrb/data.rb', line 2153

def type
  @type
end

#userUser (readonly)



2143
2144
2145
# File 'lib/discordrb/data.rb', line 2143

def user
  @user
end

Instance Method Details

#inspectObject

The inspect method is overwritten to give more useful output



2193
2194
2195
# File 'lib/discordrb/data.rb', line 2193

def inspect
  "<Integration name=#{@name} id=#{@id} type=#{@type} enabled=#{@enabled}>"
end