Class: Provider

Provider(name, options)

Represents a database provider which will extend this provider class.

Constructor

new Provider(name, options)

Parameters:
Name Type Description
name string

The name of this provider.

options object

An object of options.

Source:

Members

name :string

Represents the name of this provider.

Type:
  • string
Source:

options

Represents the options of this provider.

Source:

Methods

_is(type, value) → {boolean}

Tests if the value is of type.

Parameters:
Name Type Description
type string

The type to test for.

value any

The value to test.

Source:
Returns:

Whether the value is of property.

Type
boolean

(async) createUser(id, guild_id, xp) → {boolean}

The function that is called when a user is created.

Parameters:
Name Type Description
id string

The id of the user that is being created.

guild_id string

The id of the guild of the user that is being created.

xp number

The amount of xp of the user that is being created.

Source:
Returns:
  • Whether this user has been created or not.
Type
boolean

(async) getMembersFor(guild_id) → {object}

The function is called when a users of a guild are fetched from the database. Returns an array of objects: { user_id: String, guild_id: String, xp: Number, last_Updated: Number }

Parameters:
Name Type Description
guild_id string

The id of the guild whose members are fetched.

Source:
Returns:
  • An array of objects with properties id, guild_id, xp, last_updated.
Type
object

(async) getUser(id, guild_id) → {object}

The function is called when a user is fetched from the database. Returns an object: { user_id: String, guild_id: String, xp: Number, last_Updated: Number }

Parameters:
Name Type Description
id string

The id of the user that is being updated.

guild_id string

The id of the guild of the user that is being updated.

Source:
Returns:
  • On object with properties id, guild_id, xp, last_updated.
Type
object

(async) init()

The function that is called after the provider's been initialized.

Source:

(async) updateUser(id, guild_id, xp) → {boolean}

The function that is called when a user is updated.

Parameters:
Name Type Description
id string

The id of the user that is being updated.

guild_id string

The id of the guild of the user that is being updated.

xp number

The amount of xp of the user that is being updated.

Source:
Returns:
  • Whether this user has been updated or not.
Type
boolean