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.



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/discordrb/data.rb', line 88

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.



86
87
88
# File 'lib/discordrb/data.rb', line 86

def id
  @id
end

#membersObject (readonly)

Returns the value of attribute members.



86
87
88
# File 'lib/discordrb/data.rb', line 86

def members
  @members
end

#nameObject (readonly)

Returns the value of attribute name.



86
87
88
# File 'lib/discordrb/data.rb', line 86

def name
  @name
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



86
87
88
# File 'lib/discordrb/data.rb', line 86

def owner_id
  @owner_id
end

#regionObject (readonly)

Returns the value of attribute region.



86
87
88
# File 'lib/discordrb/data.rb', line 86

def region
  @region
end