UNPKG

@getsolara/solara.db

Version:

Optional database functionality for @getsolara/solara.js using quick.db

19 lines 839 B
module.exports = { name: "$dbGet", description: "Gets a value from the database by key. Args: key", takesBrackets: true, execute: async (context, args) => { if (!context.client.db) { return "[Error: $dbGet requires database features to be enabled. Ensure @getsolara/solara.db is installed and configured correctly.]"; } if (!args[0]) return "[Error: $dbGet requires a key]"; const key = args[0]; try { const value = await context.client.db.get(key); return value !== null && value !== undefined ? String(value) : ""; } catch (e) { console.error(`Solara.db Error ($dbGet): Failed to get key '${key}'. Error: ${e.message}`); return `[DB Error getting key '${key}': ${e.message}]`; } } };