@getsolara/solara.db
Version:
Optional database functionality for @getsolara/solara.js using quick.db
19 lines • 782 B
JavaScript
module.exports = {
name: "$dbDelete",
description: "Deletes a key from the database. Args: key",
takesBrackets: true,
execute: async (context, args) => {
if (!context.client.db) {
return "[Error: $dbDelete requires database features to be enabled. Ensure @getsolara/solara.db is installed and configured correctly.]";
}
if (!args[0]) return "[Error: $dbDelete requires a key]";
const key = args[0];
try {
await context.client.db.delete(key);
return "";
} catch (e) {
console.error(`Solara.db Error ($dbDelete): Failed to delete key '${key}'. Error: ${e.message}`);
return `[DB Error deleting key '${key}': ${e.message}]`;
}
}
};