class DDAPI::User

Represents a DRPG user.

Attributes

deaths[RW]

@return [Integer] How much deaths that user has

donated[RW]

@return [true, false] whether the user donated to Discord Dungeons or not.

donated?[RW]

@return [true, false] whether the user donated to Discord Dungeons or not.

experience[RW]

@return [Integer] How much experience that user has

frags[RW]

@return [Integer] How much deaths that user has

gold[RW]

@return [Integer] How much gold that user has

health[RW]

@return [Integer] How much health that user has

hp[RW]

@return [Integer] How much health that user has

id[RW]

@return [Integer] The ID of the user.

kills[RW]

@return [Integer] How much kills that user has

level[RW]

@return [Integer] The level at that time, of the user.

max_health[RW]

@return [Integer] How much maximun health that user has

max_hp[RW]

@return [Integer] How much maximun health that user has

name[RW]

@return [Srting] The name of the user.

nickname[RW]

@return [Srting] The name of the user.

xp[RW]

@return [Integer] How much experience that user has

Public Class Methods

new(data, app) click to toggle source
# File lib/dd-api/classes.rb, line 61
def initialize(data, app)
  @data = data['data']
  @id = data['id']
  @name = @data['name']
  @level = @data['level']
  @hp = @data['hp']
  @max_hp = @data['maxhp']
  @gold = @data['gold']
  @xp = @data['xp']
  @kills = @data['kills']
  @deaths = @data['deaths']
  @weapon_id = @data['weapon']
  @donated = @data['donate']
  @guild = @data['guild']
  @app = app
end

Public Instance Methods

guild() click to toggle source

@return [Guild, nil] the user's guild

# File lib/dd-api/classes.rb, line 79
def guild
  if @guild != ""
    @app.guild(@guild)
  else
    nil
  end
end
inspect() click to toggle source

The inspect method is overwritten to give more useful output

# File lib/dd-api/classes.rb, line 88
def inspect
  "#<DDAPI::User name=#{@name} id=#{@id} level=#{@level}>"
end