{"id":10491,"library":"aidyn","title":"Aidyn: Discord Bot Framework","description":"Aidyn is a lightweight, class-based framework designed for rapidly building Discord bot commands, abstracting away much of the boilerplate associated with `discord.js` interaction. It is currently at version 1.1.1, indicating a relatively early but stable stage of development. While no explicit release cadence is stated, its versioning suggests a focused development approach. Key differentiators include its class-based command architecture, native TypeScript support (as the project is built in TypeScript), built-in state management for data handling between commands, and an integrated feature for automatic database backup specifically with MongoDB. It aims to let developers jump straight to business logic for their bot commands, providing a structured approach on top of `discord.js`.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/PaulEndri/aidyn","tags":["javascript"],"install":[{"cmd":"npm install aidyn","lang":"bash","label":"npm"},{"cmd":"yarn add aidyn","lang":"bash","label":"yarn"},{"cmd":"pnpm add aidyn","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library upon which Aidyn is built for Discord API interaction.","package":"discord.js","optional":false},{"reason":"Required for database features, including automatic database backups.","package":"mongodb","optional":true}],"imports":[{"note":"Aidyn is primarily designed for modern JavaScript and TypeScript environments, favoring ESM imports.","wrong":"const { Aidyn } = require('aidyn');","symbol":"Aidyn","correct":"import { Aidyn } from 'aidyn';"},{"note":"The base class for all custom bot commands. Extends this class to define command logic.","wrong":"const { Command } = require('aidyn');","symbol":"Command","correct":"import { Command } from 'aidyn';"},{"note":"While Aidyn wraps Discord.js, core Discord.js types like `Message` are imported directly from `discord.js` itself for type accuracy and direct API access.","wrong":"import { Message } from 'aidyn';","symbol":"Message","correct":"import { Message } from 'discord.js';"}],"quickstart":{"code":"import { Aidyn, Command } from 'aidyn';\nimport { Message } from 'discord.js'; // Assuming discord.js is installed\n\nclass ExampleCommand extends Command {\n    static NAME = 'example';\n\n    public Name(): string {\n        return ExampleCommand.NAME;\n    }\n    public Namespace(): string {\n        return 'ExampleNamespace';\n    }\n\n    public async Run(message: Message): Promise<any> {\n        const context = this.GetContext(message); // Process message content for args/flags\n\n        return message.channel.send(`Command: %example was called with content ${JSON.stringify(context)}`);\n    }\n}\n\nconst commands: { [key: string]: typeof Command } = {};\ncommands[ExampleCommand.NAME] = ExampleCommand;\n\n// Ensure you have these environment variables set\nconst botToken = process.env.DISCORD_BOT_TOKEN ?? 'YOUR_BOT_TOKEN_HERE';\nconst mongoConnectionString = process.env.MONGO_CONNECTION_STRING ?? '';\n\nconst aidyn = new Aidyn({\n    Prefix: '%',\n    ConnectionString: mongoConnectionString, // Required for database features (MongoDB only)\n    BotToken: botToken,\n    Logging: 1 // Log commands. Use 0 for no logging, 2 for verbose (not recommended)\n});\n\naidyn.start(commands);\nconsole.log('Aidyn bot started with example command!');","lang":"typescript","description":"Initializes and starts a Discord bot using Aidyn, defining a simple command that responds with processed message content. This example demonstrates class-based command creation and bot setup with environment variables for credentials."},"warnings":[{"fix":"Set `Logging: 0` or `Logging: 1` in the Aidyn constructor. Avoid `Logging: 2` unless specifically debugging a critical issue and understand the performance implications.","message":"The `Logging` parameter in the Aidyn constructor has a level `2` which is explicitly 'NOT RECOMMENDED' due to excessive verbosity. Stick to `0` for no logging or `1` for command logging to avoid performance issues or overwhelming console output.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you have a MongoDB instance and a valid connection string if you plan to use Aidyn's database features. For other databases, implement custom data handling outside of Aidyn's provided mechanisms.","message":"Aidyn currently supports only MongoDB for its database features, including automatic backups. If your project requires a different database system, you will need to manage its integration externally without leveraging Aidyn's built-in capabilities.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always use `import ... from 'aidyn'` for importing Aidyn components. Ensure your project's `package.json` is configured for ESM where appropriate (e.g., `\"type\": \"module\"`).","message":"The framework primarily uses modern JavaScript (ESM) import syntax. Attempting to use CommonJS `require()` syntax for core `aidyn` modules may lead to runtime errors or unexpected behavior, especially in environments configured for ESM.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your Node.js environment is at least v8 LTS. For best compatibility and security, it is recommended to use an active LTS version of Node.js (e.g., Node.js 18 or 20).","message":"Aidyn requires Node.js v8 LTS or higher. While this is an older version, running on unsupported or significantly older Node.js versions may lead to compatibility issues or missing features, as Discord.js and its dependencies evolve.","severity":"breaking","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Verify that `BotToken` in the Aidyn constructor is correct and that your bot has all necessary intents and permissions enabled in the Discord Developer Portal.","cause":"The bot token provided is invalid, missing, or has incorrect permissions for the requested operation.","error":"DiscordAPIError: Missing Access"},{"fix":"Double-check your `ConnectionString` in the Aidyn constructor. Ensure the MongoDB server is accessible from where your bot is hosted and that no firewalls are blocking the connection.","cause":"The MongoDB `ConnectionString` provided is incorrect, the MongoDB server is not running, or there's a network issue preventing connection.","error":"MongoServerSelectionError: connect ECONNREFUSED <IP>:<PORT>"},{"fix":"Add `import { Command } from 'aidyn';` to the top of your file where you define custom commands.","cause":"The `Command` base class was not imported before being extended.","error":"ReferenceError: Command is not defined"},{"fix":"Ensure you have `const aidyn = new Aidyn({...});` before calling `aidyn.start(commands);`. Double-check the casing and spelling of the method name.","cause":"The `aidyn` instance was not correctly initialized, or `start` was called on a non-Aidyn object.","error":"TypeError: aidyn.start is not a function"}],"ecosystem":"npm"}