Constructor
new XpManager(provider, options)
Parameters:
| Name | Type | Description |
|---|---|---|
provider |
string | The name of the provider, currently supporting |
options |
mongodbProviderOptions | jsonProviderOptions | The options for your specific provider. |
- Source:
Members
provider :Provider
The provider for this manager.
Type:
- Source:
Methods
create(id, guildID, xp) → {boolean}
It adds another user to the database.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
id |
string | The id of the user. |
|
guildID |
string | The guild id the user is in. |
|
xp |
number | 0 | The amount of xp to set the user, default to 0. |
- Source:
Returns:
Whether or not the user has been created.
- Type
- boolean
fetch(id, guildID) → {Promise.<(User|null)>}
Fetches the user from database and returns an instance of user client.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The id of the user you want to fetch. |
guildID |
string | The guild user is a member of. |
- Source:
Returns:
Returns an user object or nothing.
- Type
- Promise.<(User|null)>
(async) fetchOrCreate(id, guildID, xp) → {User}
Fetches the user or creates it and then fetches it.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
id |
* | The id of the user. |
|
guildID |
* | The id of the guild user is in. |
|
xp |
* | 0 | The initial amount of xp to set. |
- Source:
Returns:
The user returned.
- Type
- User