Class: Player

HungryGames~ Player


new Player(id, username, avatarURL [, nickname])

Serializable container for data pertaining to a single user.
Parameters:
Name Type Argument Default Description
id string The id of the user this object is representing.
username string The name of the user to show in the game.
avatarURL string URL to avatar to show for the user in the game.
nickname string <optional>
<nullable>
null The nickname for this user usually assigned by the guild. If the user does not have a nickname, this will have the same value as `name`.
Source:

Members


avatarURL :string

The URL to the discord avatar of the User.
Type:
  • string
Default Value:
  • ''
Source:

bleeding :number

How many days has the player been wounded.
Type:
  • number
Source:

dayOfDeath :number

The day at which the player last died in the game. Only a valid number if the player is currently dead. Otherwise a garbage value will be available.
Type:
  • number
Source:

id :string

The id of the User this Player represents.
Type:
  • string
Source:

kills :number

The number of players this player has caused to die.
Type:
  • number
Source:

living :boolean

Is the player still alive.
Type:
  • boolean
Default Value:
  • true
Source:

name :string

The name of this Player.
Type:
  • string
Source:

nickname :string

The nickname for this user usually assigned by the guild. If the user does not have a nickname, this will have the same value as `name`.
Type:
  • string
Source:

rank :number

The current rank of the player in the game.
Type:
  • number
Default Value:
  • 1
Source:

settings :object

Custom settings for this user associated with the games.
Type:
  • object
Default Value:
  • {}
Source:

state :string

The current player state (normal, wounded, dead, zombie).
Type:
  • string
Default Value:
  • normal
Source:

weapons :object.<number>

The weapons the player currently has and how many of each.
Type:
  • object.<number>
Default Value:
  • {}
Source:

Methods


<static> from(member)

Create a Player from a given Discord.User or Player-like Object. Can be used as a copy-constructor.
Parameters:
Name Type Description
member Discord~User | Discord~GuildMember | object Object, User or GuildMember to make a Player from.
Source:
Returns:
Player object created.
Type
HungryGames~Player