Optional
scoped: booleanOptional
customStorage: StateServiceOptional
customKey: stringEnter some scene
Optional
params: { Optional
reset?: booleanIf currently in a scoped scene, whether to reset the state
Optional
ttl?: numberTTL for the scene (in seconds)
Optional
with?: SceneStateInitial state for the scene
Note that this will only work if the scene uses the same key delegate as this state.
Retrieve the state from the storage, falling back to default if not found
Retrieve the state from the storage, falling back to default if not found
Retrieve the state from the storage
Optional
force: booleanWhether to ignore cached state (def. false
)
Rate limit some handler.
When the rate limit exceeds, RateLimitError is thrown.
This is a simple rate-limiting solution that uses the same key as the state. If you need something more sophisticated and/or customizable, you'll have to implement your own rate-limiter.
Note:
key
is used to prefix the local key derived using the given key delegate.
Key of the rate limit
Maximum number of requests in window
Window size in seconds
Tuple containing the number of remaining and unix time in ms when the user can try again
Set new state to the storage
New state
Optional
ttl: numberTTL for the new state (in seconds)
Throttle some handler.
When the rate limit exceeds, this function waits for it to reset.
This is a simple wrapper over rateLimit, and follows the same logic.
Note:
key
is used to prefix the local key derived using the given key delegate.
Key of the rate limit
Maximum number of requests in window
Window size in seconds
Tuple containing the number of remaining and unix time in ms when the user can try again
State of the current update.
Template: SceneName
Possible scene names