Class: WeebSh::User

Inherits:
Object
  • Object
show all
Includes:
IDObject
Defined in:
lib/weeb/data.rb

Overview

Represents a user for shimakaze

Instance Attribute Summary collapse

Attributes included from IDObject

#id

Instance Method Summary collapse

Methods included from IDObject

#==

Instance Attribute Details

#accountString (readonly)


195
196
197
# File 'lib/weeb/data.rb', line 195

def 
  @account
end

#available_reputationInteger? (readonly)


205
206
207
# File 'lib/weeb/data.rb', line 205

def available_reputation
  @available_reputation
end

#bot_idString (readonly)


192
193
194
# File 'lib/weeb/data.rb', line 192

def bot_id
  @bot_id
end

#cooldownArray<Time> (readonly) Also known as: taken_reputation


198
199
200
# File 'lib/weeb/data.rb', line 198

def cooldown
  @cooldown
end

#given_reputationArray<Time> (readonly)


202
203
204
# File 'lib/weeb/data.rb', line 202

def given_reputation
  @given_reputation
end

#next_available_reputationArray<Time>? (readonly)


208
209
210
# File 'lib/weeb/data.rb', line 208

def next_available_reputation
  @next_available_reputation
end

#reputationInteger (readonly) Also known as: rep


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

#resetUser

Resets the user


238
239
240
241
242
# File 'lib/weeb/data.rb', line 238

def reset
  response = WeebSh::API::Shimakaze.reset(@interface, @bot_id, @id)
  patch(response['user'])
  self
end