JSPM

@mattythedev01/easydatadb

1.0.4
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 8
    • Score
      100M100P100Q43339F
    • License ISC

    Makes you a bot

    Package Exports

    • @mattythedev01/easydatadb
    • @mattythedev01/easydatadb/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mattythedev01/easydatadb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @mattythedev01/easydatadb Documentation

    Overview

    "@mattythedev01/easydatadb", is a easy way to store data for your discord bot or any other projects outside of discord. It'll make a json folder & file in your current directory, and those files will store the data you input (Mainly used for discord bots).

    Features

    • Works with the Discord Latest API Version
    • Simple and intuitive API
    • Automatic data persistence
    • Timestamp tracking for each entry
    • Support for various data types (strings, numbers, arrays, objects)
    • File-based storage for easy backup and portability

    Installation

    npm install @mattythedev01/easydatadb

    Example Usage

    // Example usage of easydatadb
    
    // Import the EasyDataDB package
    const EasyDataDB = require("@mattythedev01/easydatadb");
    
    // Create an instance of EasyDataDB
    const db = new EasyDataDB("json/mydatabase.json");
    
    // Set some data
    db.set("username", "mattythedev01");
    db.setUserData("user123", "age", 30);
    db.setGuildData("guild456", "name", "My Guild");
    
    // Get data
    const username = db.get("username");
    const userAge = db.getUserData("user123", "age");
    const guildName = db.getGuildData("guild456", "name");
    
    console.log(`Username: ${username}`); // Output: Username: mattythedev01
    console.log(`User Age: ${userAge}`); // Output: User Age: 30
    console.log(`Guild Name: ${guildName}`); // Output: Guild Name: My Guild
    
    // Check if a key exists
    const hasUser = db.has("username"); // true
    
    // Delete a key
    db.delete("username");
    
    // Clear all data
    db.clear();