SettingStorage
Extends:
Stores settings within a guild
Constructor Summary
| Public Constructor | ||
| public |
constructor(localStorage: LocalStorage, logger: Logger) |
|
Method Summary
| Public Methods | ||
| public |
Deletes a setting from the storage |
|
| public |
Checks if a setting associated with a guild exists |
|
| public |
Finds all settings associated with a guild or a single one with a key |
|
| public |
Gets the value of a setting associated with a guild |
|
| public |
Saves a setting to the storage |
|
Public Constructors
public constructor(localStorage: LocalStorage, logger: Logger) source
Params:
| Name | Type | Attribute | Description |
| localStorage | LocalStorage | The LocalStorage instance to use |
|
| logger | Logger |
|
The logger to use |
Public Methods
public delete(guild: Guild | string, setting: Setting | string): boolean source
Deletes a setting from the storage
public exists(guild: Guild | string, setting: Setting | string): boolean source
Checks if a setting associated with a guild exists
public find(guild: Guild | string, setting: Setting | string): *[] source
Finds all settings associated with a guild or a single one with a key
Return:
| *[] | All found setting values |
public getValue(guild: Guild | string, setting: Setting | string, defaultValue: *): * source
Gets the value of a setting associated with a guild
Params:
| Name | Type | Attribute | Description |
| guild | Guild | string |
|
The guild or guild ID the setting is associated with |
| setting | Setting | string | The setting or setting key (must be a setting instance if the guild isn't specified) |
|
| defaultValue | * |
|
The value to default to if the setting doesn't exist |
Return:
| * | The value of the setting |