@blitz-bots/bot@1.5.1Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
This bot is designed to load and manage plugins dynamically, handling their respective events and commands.
This bot is designed to load and manage plugins dynamically, handling their respective events and commands.
Example Usage
const bot = new Bot({ token: token }); bot.start();
Custom Intents
const customIntents = [ IntentsBitField.Flags.Guilds, IntentsBitField.Flags.GuildMessages, ]; const bot = new Bot({ token: token, intents: customIntents }); bot.start();
Custom Plugin Directory
const bot = new Bot({ token: token, pluginsDir: "./custom_plugins" }); bot.start();
Load Within A Server
const bot = new Bot({ token: token, server: "123456789101112" }); bot.start();
Project Structure
The project is organized into a clear directory structure that separates the core bot code, configuration, and plugin functionality. Each plugin can define its own commands and events, making it easy to add or remove functionality as needed.
. ├── bot.ts └── plugins └── plugin_1 ├── blitz.config.yaml ├── events │ └── ready.ts └── commands └── ping.ts
Explanation of Key Files and Directories
bot.ts: The main entry point for the bot. This file is responsible for initializing the bot, loading configuration settings, and dynamically importing plugins along with their events and commands.plugins/: Contains all plugins. Each plugin is organized into subdirectories foreventsandcommands, which helps in managing individual plugin functionality independently. Each plugin contains ablitz.config.yamlfile which contains all metadata and config for a plugin.
Example Plugin Structure
Each plugin follows a standardized structure within the plugins/ folder. For
example:
plugin_1 ├── blitz.config.yaml ├── events │ └── ready.ts └── commands └── ping.ts
This structure helps keep the bot modular and scalable. Adding a new plugin is
as simple as creating a new folder under plugins and adding corresponding
event or command files.
Example 1
Example 1
import { Bot } from './Bot'; import { IntentsBitField } from 'discord.js'; // Using default intents const bot = new Bot('your-discord-bot-token'); bot.start(); // Using custom intents and custom plugin directory const customIntents = [ IntentsBitField.Flags.Guilds, IntentsBitField.Flags.GuildMessages, ]; const customBot = new Bot({ token: 'your-discord-bot-token', intents: customIntents, pluginsDir: './custom_plugins', }); customBot.start();
Also, use deno fmt to format the files for consistent formatting.
Add Package
deno add jsr:@blitz-bots/bot
Import symbol
import * as bot from "@blitz-bots/bot";
Import directly with a jsr specifier
import * as bot from "jsr:@blitz-bots/bot";