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



2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
# File 'lib/discordrb/data.rb', line 2840

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

#accountIntegrationAccount (readonly)



2828
2829
2830
# File 'lib/discordrb/data.rb', line 2828

def 
  @account
end

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



2815
2816
2817
# File 'lib/discordrb/data.rb', line 2815

def emoticon
  @emoticon
end

#enabledtrue, false (readonly)



2822
2823
2824
# File 'lib/discordrb/data.rb', line 2822

def enabled
  @enabled
end

#expire_behaviourSymbol (readonly) Also known as: expire_behavior



2834
2835
2836
# File 'lib/discordrb/data.rb', line 2834

def expire_behaviour
  @expire_behaviour
end

#expire_grace_periodInteger (readonly)



2838
2839
2840
# File 'lib/discordrb/data.rb', line 2838

def expire_grace_period
  @expire_grace_period
end

#nameString (readonly)



2803
2804
2805
# File 'lib/discordrb/data.rb', line 2803

def name
  @name
end

#roleRole? (readonly)



2812
2813
2814
# File 'lib/discordrb/data.rb', line 2812

def role
  @role
end

#serverServer (readonly)



2806
2807
2808
# File 'lib/discordrb/data.rb', line 2806

def server
  @server
end

#synced_atTime (readonly)



2831
2832
2833
# File 'lib/discordrb/data.rb', line 2831

def synced_at
  @synced_at
end

#syncingtrue, false (readonly)



2825
2826
2827
# File 'lib/discordrb/data.rb', line 2825

def syncing
  @syncing
end

#typeString (readonly)



2819
2820
2821
# File 'lib/discordrb/data.rb', line 2819

def type
  @type
end

#userUser (readonly)



2809
2810
2811
# File 'lib/discordrb/data.rb', line 2809

def user
  @user
end

Instance Method Details

#inspectObject

The inspect method is overwritten to give more useful output



2859
2860
2861
# File 'lib/discordrb/data.rb', line 2859

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