Class: WeebSh::User
Overview
Represents a user for shimakaze
Instance Attribute Summary collapse
-
#account ⇒ String
readonly
The ID of the account from the token.
-
#available_reputation ⇒ Integer?
readonly
The amount to times the user may give reputation.
-
#bot_id ⇒ String
readonly
The ID of the bot that issues reputation.
-
#cooldown ⇒ Array<Time>
(also: #taken_reputation)
readonly
The last time(s) this user has given reputation to another user.
-
#given_reputation ⇒ Array<Time>
readonly
The last time(s) this user has received reputation from another user.
-
#next_available_reputation ⇒ Array<Time>?
readonly
The timestamps referring to the remaining cooldown time until the user can give out reputation from now.
-
#reputation ⇒ Integer
(also: #rep)
readonly
The reputation of the user.
Attributes included from IDObject
Instance Method Summary collapse
-
#decrease(amount) ⇒ User
Decreases the user’s reputation.
-
#give(user) ⇒ User
Gives reputation to another user.
-
#increase(amount) ⇒ User
Increases the user’s reputation.
-
#recieve(user) ⇒ User
Recieves reputation to another user.
-
#reset ⇒ User
Resets the user.
Methods included from IDObject
Instance Attribute Details
#account ⇒ String (readonly)
Returns the ID of the account from the token.
195 196 197 |
# File 'lib/weeb/data.rb', line 195 def account @account end |
#available_reputation ⇒ Integer? (readonly)
Returns the amount to times the user may give reputation.
205 206 207 |
# File 'lib/weeb/data.rb', line 205 def available_reputation @available_reputation end |
#bot_id ⇒ String (readonly)
Returns the ID of the bot that issues reputation.
192 193 194 |
# File 'lib/weeb/data.rb', line 192 def bot_id @bot_id end |
#cooldown ⇒ Array<Time> (readonly) Also known as: taken_reputation
Returns the last time(s) this user has given reputation to another user.
198 199 200 |
# File 'lib/weeb/data.rb', line 198 def cooldown @cooldown end |
#given_reputation ⇒ Array<Time> (readonly)
Returns the last time(s) this user has received reputation from another user.
202 203 204 |
# File 'lib/weeb/data.rb', line 202 def given_reputation @given_reputation end |
#next_available_reputation ⇒ Array<Time>? (readonly)
Returns the timestamps referring to the remaining cooldown time until the user can give out reputation from now.
208 209 210 |
# File 'lib/weeb/data.rb', line 208 def next_available_reputation @next_available_reputation end |
#reputation ⇒ Integer (readonly) Also known as: rep
Returns the reputation of the user.
188 189 190 |
# File 'lib/weeb/data.rb', line 188 def reputation @reputation end |
Instance Method Details
#decrease(amount) ⇒ User
Decreases the user’s reputation
230 231 232 233 234 |
# File 'lib/weeb/data.rb', line 230 def decrease(amount) response = WeebSh::API::Shimakaze.decrease(@interface, @bot_id, @id, amount) patch(response['user']) self end |
#give(user) ⇒ User
Gives reputation to another user
247 248 249 250 251 252 253 |
# File 'lib/weeb/data.rb', line 247 def give(user) user_id = user.resolve_id if user.respond_to?(:resolve_id) response = API::Shimakaze.give(@interface, @bot_id, @id, user_id || user) patch(response['sourceUser']) user.patch(response['targetUser']) if user.is_a?(User) self end |
#increase(amount) ⇒ User
Increases the user’s reputation
221 222 223 224 225 |
# File 'lib/weeb/data.rb', line 221 def increase(amount) response = WeebSh::API::Shimakaze.increase(@interface, @bot_id, @id, amount) patch(response['user']) self end |
#recieve(user) ⇒ User
Recieves reputation to another user
258 259 260 261 262 263 264 |
# File 'lib/weeb/data.rb', line 258 def recieve(user) user_id = user.resolve_id if user.respond_to?(:resolve_id) response = API::Shimakaze.give(@interface, @bot_id, user_id || user, @id) patch(response['targetUser']) user.patch(response['sourceUser']) if user.is_a?(User) self end |