Skip to content

PerpetualSpace/UtilaraOSS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utilara Core

A modular Discord bot framework built with TypeScript and discord.js. This is the open-source skeleton that powers Utilara — build your own plugins on top of it.

Structure

src/
├── index.ts              # Entry point
├── MiniMCBot.ts          # Bot client class
├── core/
│   ├── Plugin.ts         # Base plugin class
│   ├── PluginManager.ts  # Plugin loader
│   ├── CommandHandler.ts # Slash & prefix command handling
│   └── EventHandler.ts   # Core Discord event wiring
├── types/
│   ├── BotCommand.ts     # Command interface
│   └── BotConfig.ts      # Config interface
├── utils/
│   ├── Database.ts       # MySQL connection pool
│   └── Logger.ts         # Console + file logger
└── plugins/              # Drop your plugins here

Setup

npm install
cp env.example .env       # Fill in your bot token and database credentials
npm run dev               # Development with ts-node
npm run build && npm start # Production

Creating a Plugin

Create a folder in src/plugins/ with an index.ts that default-exports a class extending Plugin:

import { Plugin } from "../../core/Plugin";
import { MiniMCBot } from "../../MiniMCBot";

export default class MyPlugin extends Plugin {
  public name = "my-plugin";
  public version = "1.0.0";
  public description = "Does something cool";

  constructor(bot: MiniMCBot) {
    super(bot);
  }

  public async initializeDatabase(): Promise<void> {
    // Create your tables here
  }

  public async onLoad(): Promise<void> {
    // Register commands, event listeners, etc.
  }

  public async onUnload(): Promise<void> {
    // Cleanup listeners, intervals, etc.
  }
}

The PluginManager auto-discovers and loads every subdirectory in src/plugins/ on startup.

Requirements

  • Node.js 18+
  • MySQL/MariaDB
  • A Discord bot token

License

MIT

About

A modular Discord bot framework built with TypeScript and discord.js. This is the open-source skeleton that powers Utilara. Build your own plugins on top of it.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors