Class: Discordrb::Server

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ Server

Returns a new instance of Server.



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/discordrb/data.rb', line 85

def initialize(data, bot)
  @bot = bot
  @region = data['region']
  @name = data['name']
  @owner_id = data['owner_id'].to_i
  @id = data['id'].to_i

  @members = []

  data['members'].each do |element|
    @members << User.new(element, bot)
  end
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#membersObject (readonly)

Returns the value of attribute members.



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

def members
  @members
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



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

def owner_id
  @owner_id
end

#regionObject (readonly)

Returns the value of attribute region.



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

def region
  @region
end