Documentation Index
Fetch the complete documentation index at: https://developers.duelsplus.com/llms.txt
Use this file to discover all available pages before exploring further.
Plugins get persistent key-value storage that survives proxy restarts. Data is stored as JSON in:
~/.duelsplus/plugins/<plugin-id>/storage.json
Use it for settings, caches, or any JSON-serializable state.
API
// Get a value (returns undefined if missing)
const enabled = ctx.storage.get<boolean>('enabled') ?? true;
// Set a value (persisted to disk)
ctx.storage.set('message', 'glhf');
ctx.storage.set('delay', 500);
ctx.storage.set('history', { wins: 10, losses: 3 });
// Check if a key exists
if (ctx.storage.has('message')) {
const msg = ctx.storage.get<string>('message');
}
// Delete a key
ctx.storage.delete('message');
// Get all keys and values (copy)
const all = ctx.storage.getAll();
// Clear everything (use with care)
ctx.storage.clear();
- get<T>(key) - Returns the value or
undefined. Use a type parameter for TypeScript: get<boolean>('enabled').
- set(key, value) - Stores the value. Must be JSON-serializable (primitives, plain objects, arrays). No functions or circular refs.
- delete(key) - Removes the key. Returns
true if the key existed.
- has(key) - Returns whether the key exists.
- getAll() - Returns a snapshot of all key-value pairs.
- clear() - Removes all keys for this plugin.
Example: per-plugin settings
// In onLoad or a command handler
const delay = ctx.storage.get<number>('delay') ?? 500;
ctx.storage.set('delay', 3000);
Example: opponent history (object)
const history = ctx.storage.get<Record<string, { wins: number; losses: number }>>('opponent-history') ?? {};
history[uuid] = { wins: (history[uuid]?.wins ?? 0) + 1, losses: history[uuid]?.losses ?? 0 };
ctx.storage.set('opponent-history', history);
Storage is per plugin: keys are namespaced by your plugin’s id. Other plugins cannot read or write your storage.