KeyvProvider

KeyvProvider

A Keyv based SettingProvider for the Discord.js Commando framework.

Constructor

new KeyvProvider(keyv)

Source:
See:
Parameters:
Name Type Description
keyv Keyv

Keyv instance to use for the store

Extends

  • SettingProvider

Methods

clear(guild) → {Promise.<void>}

Removes all settings in a guild

Source:
Parameters:
Name Type Description
guild Guild | string

Guild to clear the settings of

Returns:
Type:
Promise.<void>

destroy()

Destroys the provider, removing any event listeners.

Source:

(async) get(guild, key, defValopt) → {*}

Obtains a setting for a guild

Source:
Parameters:
Name Type Attributes Description
guild Guild | string

Guild the setting is associated with (or 'global')

key string

Name of the setting

defVal * <optional>

Value to default to if the setting isn't set on the guild

Returns:
Type:
*

init(client)

Initialises the provider by connecting to databases and/or caching all data in memory. CommandoClient#setProvider will automatically call this once the client is ready.

Source:
Parameters:
Name Type Description
client CommandoClient

Client that will be using the provider

(async) remove(guild, key) → {Promise.<*>}

Removes a setting from a guild

Source:
Parameters:
Name Type Description
guild Guild | string

Guild the setting is associated with (or 'global')

key string

Name of the setting

Returns:
Type:
Promise.<*>

Old value of the setting

(async) set(guild, key, val) → {Promise.<*>}

Sets a setting for a guild

Source:
Parameters:
Name Type Description
guild Guild | string

Guild to associate the setting with (or 'global')

key string

Name of the setting

val *

Value of the setting

Returns:
Type:
Promise.<*>

New value of the setting