0.2.0 • Published 4 months ago

shadow-core v0.2.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
4 months ago

ShadowCore

ShadowCore is a modular core framework for Discord bot development. It provides a streamlined system for commands, events, buttons, menus, middleware execution, API requests, and more, making bot development faster and more efficient.

GitHub package.json version
GitHub issues
GitHub forks
GitHub stars
GitHub license
npm version

🌟 Features

  • 🚀 Modular Command System - Auto-loads commands from categorized folders.
  • 🎛 Dynamic Button & Menu Handling - Supports dynamic custom IDs (feature:action:{id}). W.I.P.
  • 🛠 Middleware Support - Allows pre/post-execution logic for commands.
  • Rate Limiting & Cooldowns - Prevents spam and abuse.
  • 🌐 API Utility with Axios - Simplifies external API requests.
  • 📜 Logging with Loki - Built-in structured logging.
  • Task Scheduler - Run background tasks automatically.

📦 Installation

npm install shadow-core

🚀 Usage

Setting Up ShadowCore

Create a bot that uses the ShadowCore framework.

import { Bot } from "shadow-core";

const bot = new Bot("YOUR_BOT_TOKEN");

bot.getClient().once("ready", () => {
    console.log(`✅ Logged in as ${bot.getClient().user?.tag}`);
});

Registering Commands

Commands are automatically loaded from the /commands/{category}/ folder.
Each command file must export a command object.

Example Command Structure:

/commands/general/ping.ts
/commands/admin/ban.ts
/commands/moderation/kick.ts

Command Example: /commands/general/ping.ts

import { Command } from "shadow-core";

export default new Command({
    name: "ping",
    description: "Replies with Pong!",
    run: async (interaction) => {
        await interaction.reply("🏓 Pong!");
    },
});

Handling Dynamic Buttons W.I.P.

import { Button, splitSpecialId } from "shadow-core";

export default new Button({
    customId: "ticket:open:{id}",
    run: async (interaction) => {
        const { id } = splitSpecialId(interaction.customId);
        interaction.reply(`Opened ticket #${id}`);
    }
});

📜 License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

🤝 Contributing

  1. Fork the repository on GitHub.
  2. Clone your fork to your local machine:
    git clone https://github.com/Shadows-Development/ShadowCore.git
  3. Create a new branch for your changes:
    git checkout -b feature-new-functionality
  4. Make changes and commit them:
    git commit -m "Added new feature"
  5. Push the branch and create a pull request:
    git push origin feature-new-functionality
  6. Submit a pull request on GitHub and wait for review.

🌎 Community & Support

  • GitHub Issues - Report bugs & request features.
  • Discord Server - Join the development discussion.

Next Steps

  • Set up GitHub Actions for automated testing.
  • Improve middleware support for commands.
  • Expand unit tests for better stability.