-
-
The client this SettingGateway was created with.
Type:
- Source:
-
lib/settings/SettingGateway.js#L262
-
data
-
The data stored for this SettingGateway instance.
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/CacheManager.js#L20
-
defaultDataSchema :object
-
The schema for this instance of SettingGateway.
Type:
- Source:
-
lib/settings/SettingGateway.js#L57
-
defaults
-
The default values for this SchemaManager instance.
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/SchemaManager.js#L27
-
engine :string
-
The provider engine this instance of SettingGateway should use to handle your settings.
Type:
- Source:
-
lib/settings/SettingGateway.js#L34
-
<readonly> provider :Provider
-
The provider this SettingGateway instance uses for the persistent data operations.
Type:
- Source:
-
lib/settings/SettingGateway.js#L280
-
<readonly> resolver :Resolver
-
The resolver instance this SettingGateway uses to parse the data.
Type:
- Source:
-
lib/settings/SettingGateway.js#L271
-
schema
-
The schema created for this SchemaManager instance.
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/SchemaManager.js#L22
-
<nullable> sql :SQL
-
If the provider is SQL, this property is on charge to serialize/deserialize.
Type:
- Source:
-
lib/settings/SettingGateway.js#L43
-
<readonly> store :SettingCache
-
The SettingCache instance which initiated this SettingGateway.
Type:
- Source:
-
lib/settings/SettingGateway.js#L19
-
sync
-
Sync either all entries from the configuration, or a single one.
- Source:
-
lib/settings/SettingGateway.js#L135
-
type :string
-
The name of this instance of SettingGateway. The schema will be saved under 'name_Schema.json'.
Type:
- Source:
-
lib/settings/SettingGateway.js#L27
-
validate :function
-
The function validator for this instance of SettingGateway.
Type:
- Source:
-
lib/settings/SettingGateway.js#L50
-
<async> add(key, options [, force])
-
Add a new key to the schema.
Parameters:
Name |
Type |
Argument |
Default |
Description |
key |
string
|
|
|
The key to add. |
options |
AddOptions
|
|
|
Options for the key. |
force |
boolean
|
<optional>
|
true
|
Whether this change should modify all configurations or not. |
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/SchemaManager.js#L86
Returns:
-
Type
-
void
Example
// Add a key called 'modlog', being a TextChannel.
SchemaManager.add('modlog', { type: 'TextChannel' });
// Add a key called 'playlist-length', being an Integer with minimum value of 5 and max 20, being 15 by default.
SchemaManager.add('playlist-length', { type: 'Integer', default: 15, min: 5, max: 20 });
-
<async> create(input)
-
Create a new entry in the configuration.
Parameters:
Name |
Type |
Description |
input |
Object
|
string
|
An object containing a id property, like discord.js objects, or a string. |
- Source:
-
lib/settings/SettingGateway.js#L89
Returns:
-
Type
-
void
-
delete(key)
-
Delete the selected data from the cache by its ID.
Parameters:
Name |
Type |
Description |
key |
string
|
The data's key. |
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/CacheManager.js#L58
Returns:
-
Type
-
any
-
<async> destroy(input)
-
Remove an entry from the configuration.
Parameters:
Name |
Type |
Description |
input |
string
|
A key to delete from the cache. |
- Source:
-
lib/settings/SettingGateway.js#L100
Returns:
-
Type
-
void
-
<async> ensureCreate(target)
-
Creates the settings if it did not exist previously.
Parameters:
Name |
Type |
Description |
target |
Object
|
string
|
An object or string that can be parsed by this instance's resolver. |
- Source:
-
lib/settings/SettingGateway.js#L204
Returns:
-
Type
-
true
-
get(input)
-
Get an entry from the cache.
Parameters:
Name |
Type |
Description |
input |
string
|
A key to get the value for. |
- Overrides:
- Source:
-
lib/settings/SettingGateway.js#L110
Returns:
-
Type
-
Object
-
getAll()
-
Get all the data from the cache as an array of objects.
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/CacheManager.js#L37
Returns:
-
Type
-
Array.<Object>
-
<async> getResolved(input [, guild])
-
Updates an entry.
Parameters:
Name |
Type |
Argument |
Default |
Description |
input |
Object
|
string
|
|
|
An object containing a id property, like Discord.js objects, or a string. |
guild |
external:Guild
|
<optional>
|
null
|
A Guild resolvable, useful for when the instance of SG doesn't aim for Guild settings. |
- Source:
-
lib/settings/SettingGateway.js#L121
Returns:
-
Type
-
Object
-
<async> init()
-
Initialize the configuration for this gateway.
- Source:
-
lib/settings/SettingGateway.js#L69
Returns:
-
Type
-
void
-
<async> initSchema()
-
Initialize the SchemaManager.
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/SchemaManager.js#L34
Returns:
-
Type
-
void
-
<async> remove(key [, force])
-
Remove a key from the schema.
Parameters:
Name |
Type |
Argument |
Default |
Description |
key |
string
|
|
|
The key to remove. |
force |
boolean
|
<optional>
|
false
|
Whether this change should modify all configurations or not. |
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/SchemaManager.js#L116
Returns:
-
Type
-
void
Example
// Remove a key called 'modlog'.
SchemaManager.remove('modlog');
-
<async> reset(input, key)
-
Reset a key's value to default from a entry.
Parameters:
Name |
Type |
Description |
input |
Object
|
string
|
An object containing a id property, like Discord.js objects, or a string. |
key |
string
|
The key to reset. |
- Source:
-
lib/settings/SettingGateway.js#L160
Returns:
-
Type
-
any
-
set(key, value)
-
Save a new data to the cache.
Parameters:
Name |
Type |
Description |
key |
string
|
The data's key. |
value |
Object
|
The data's value. |
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/CacheManager.js#L48
Returns:
-
Type
-
any
-
<async> update(input, object [, guild])
-
Updates an entry.
Parameters:
Name |
Type |
Argument |
Default |
Description |
input |
Object
|
string
|
|
|
An object or string that can be parsed by this instance's resolver. |
object |
Object
|
|
|
An object with pairs of key/value to update. |
guild |
Object
|
string
|
<optional>
|
null
|
A Guild resolvable, useful for when the instance of SG doesn't aim for Guild settings. |
- Source:
-
lib/settings/SettingGateway.js#L178
Returns:
-
Type
-
Object
-
<async> updateArray(input, action, key, data)
-
Update an array from the configuration.
Parameters:
Name |
Type |
Description |
input |
Object
|
string
|
An object containing a id property, like discord.js objects, or a string. |
action |
'add'
|
'remove'
|
Either 'add' or 'remove'. |
key |
string
|
The key from the Schema. |
data |
any
|
The value to be added or removed. |
- Source:
-
lib/settings/SettingGateway.js#L220
Returns:
-
Type
-
boolean
-
validateSchema(schema)
-
Validate the Schema manager.
Parameters:
Name |
Type |
Description |
schema |
Object
|
The Schema object that will be used for the configuration system. |
- Inherited From:
-
- Overrides:
- Source:
-
lib/settings/SchemaManager.js#L48
Returns:
-
Type
-
void