Class: DDAPI::Guild
- Inherits:
-
Object
- Object
- DDAPI::Guild
- Defined in:
- lib/dd-api/classes.rb
Overview
Represents a DRPG guild.
Instance Attribute Summary collapse
-
#channel ⇒ String?
The Discord Channel ID of the guild.
-
#deaths ⇒ Integer
(also: #frags)
The combined deaths by the guild members.
-
#description ⇒ String
(also: #desc)
The description of the guild.
-
#gold ⇒ Integer
The amount gold in the guild.
-
#icon ⇒ String
The icon of the guild.
-
#icons ⇒ Array<String>
Array of icons the guild has bought.
-
#id ⇒ Integer
The ID of the guild.
-
#kills ⇒ Integer
(also: #slain)
The combined enemies slain by the guild members.
-
#level ⇒ Integer
The level of the guild.
-
#level_requirement ⇒ Integer
The level requirement of the guild.
-
#max ⇒ Integer
The maximum amount of people that can be in the guild.
-
#name ⇒ String
The name of the guild.
-
#open ⇒ true, false
Whether the guild is open.
-
#owner ⇒ User
(also: #leader)
The user object of the guild owner.
-
#role ⇒ String?
The Discord Role ID of the guild.
Instance Method Summary collapse
-
#initialize(data, app) ⇒ Guild
constructor
A new instance of Guild.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
Constructor Details
#initialize(data, app) ⇒ Guild
Returns a new instance of Guild.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/dd-api/classes.rb', line 143 def initialize(data, app) @data = data gdata = data['guild'] @name = data['name'] @open = data['open'] @level = gdata['level'] @description = gdata['desc'] @gold = gdata['gold'] @kills = @data['slain'] @deaths = @data['deaths'] @icon = HTMLEntities.new.decode(gdata['icon']) @icons = gdata['icons'].map {|icon| HTMLEntities.new.decode(icon) } @id = data['id'] @members = gdata['members'] @level_requirement = gdata['levelreq'] @max = gdata['max'] @owner = @app.user(gdata['owner']) @role = gdata['role'].empty? ? nil : gdata['role'] @channel = gdata['channel'].empty? ? nil : gdata['channel'] @app = app end |
Instance Attribute Details
#channel ⇒ String?
Returns The Discord Channel ID of the guild. nil if there is no channel.
141 142 143 |
# File 'lib/dd-api/classes.rb', line 141 def channel @channel end |
#deaths ⇒ Integer Also known as: frags
Returns The combined deaths by the guild members.
112 113 114 |
# File 'lib/dd-api/classes.rb', line 112 def deaths @deaths end |
#description ⇒ String Also known as: desc
Returns The description of the guild.
102 103 104 |
# File 'lib/dd-api/classes.rb', line 102 def description @description end |
#gold ⇒ Integer
Returns The amount gold in the guild.
109 110 111 |
# File 'lib/dd-api/classes.rb', line 109 def gold @gold end |
#icon ⇒ String
Returns The icon of the guild.
132 133 134 |
# File 'lib/dd-api/classes.rb', line 132 def icon @icon end |
#icons ⇒ Array<String>
Returns Array of icons the guild has bought.
135 136 137 |
# File 'lib/dd-api/classes.rb', line 135 def icons @icons end |
#id ⇒ Integer
Returns The ID of the guild.
126 127 128 |
# File 'lib/dd-api/classes.rb', line 126 def id @id end |
#kills ⇒ Integer Also known as: slain
Returns The combined enemies slain by the guild members.
116 117 118 |
# File 'lib/dd-api/classes.rb', line 116 def kills @kills end |
#level ⇒ Integer
Returns The level of the guild.
123 124 125 |
# File 'lib/dd-api/classes.rb', line 123 def level @level end |
#level_requirement ⇒ Integer
Returns The level requirement of the guild.
129 130 131 |
# File 'lib/dd-api/classes.rb', line 129 def level_requirement @level_requirement end |
#max ⇒ Integer
Returns The maximum amount of people that can be in the guild.
120 121 122 |
# File 'lib/dd-api/classes.rb', line 120 def max @max end |
#name ⇒ String
Returns The name of the guild.
95 96 97 |
# File 'lib/dd-api/classes.rb', line 95 def name @name end |
#open ⇒ true, false
Returns Whether the guild is open.
106 107 108 |
# File 'lib/dd-api/classes.rb', line 106 def open @open end |
#owner ⇒ User Also known as: leader
Returns The user object of the guild owner.
98 99 100 |
# File 'lib/dd-api/classes.rb', line 98 def owner @owner end |
#role ⇒ String?
Returns The Discord Role ID of the guild. nil if there is no role.
138 139 140 |
# File 'lib/dd-api/classes.rb', line 138 def role @role end |
Instance Method Details
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
166 167 168 |
# File 'lib/dd-api/classes.rb', line 166 def inspect "#<DDAPI::Guild name=#{@name} id=#{@id} level=#{@level}>" end |