UserCard

Represents a user in the database/cache.

Constructor

new UserCard(client, data)

Parameters:
NameTypeDescription
clientDiscord.ClientDiscord client
dataUserEntryData extracted from the database/cache

Extends

Members

achievements :Array.<Achievement>

- Users achievements
Type:

client :Discord.Client

- Discord Client
Type:
  • Discord.Client

id :Discord.Snowflake

- Users Id
Type:
  • Discord.Snowflake

level :Number

Users level
Type:
  • Number

maxXpToLevelUp :Number

Users xp needed to level up
Type:
  • Number

rank :Rank

- Users rank
Type:

username :String

- Users username
Type:
  • String

xp :Number

- Users actual xp
Type:
  • Number

Methods

achievementProgress(achievement, progress) → {Boolean}

Updates a achievement progress and unlocks it if the progress is equal or greater than the achievement's max progress. The new progress will overwrite the old progress so if you want add more progress to the achievement you need to add the old progress to the new progress.
Parameters:
NameTypeDescription
achievementAchievementAchievement to update.
progressNumberProgress to update.
Returns:
- If the achievement was unlocked.
Type: 
Boolean
Example
user.achievementProgress(achievement, achievement.progress[0] + 10)

toJSON() → {UserEntry}

Returns the user as a JSON object.
Returns:
Type: 
UserEntry