Skip to content

Repository files navigation

🤖 DBI - Discord Bot Infrastructure

npm versionnpm downloadsLicense

The most advanced, modern, and developer-friendly Discord.js v14 bot infrastructure.

Getting StartedFeaturesDocumentationExamples


✨ Features

FeatureDescription
🎯 Slash CommandsFull support with 14 option types, autocomplete, and subcommands
🔘 ComponentsButtons, Select Menus (5 types), and Modals with built-in state management
🌍 LocalizationMulti-language support for both content and command translations
📨 EventsDiscord events, custom events, and internal DBI events
💬 Message CommandsAutomatic slash command emulation from prefix commands
🔗 Reference SystemPass complex data through component interactions
🚀 Multi-ClientRun multiple bots with namespace isolation
Hybrid ShardingScale to millions of servers with discord-hybrid-sharding
🎨 Svelte ComponentsBuild reactive Discord UIs with Svelte 5 (HTMLComponentsV2)
🔄 Hot ReloadingUpdate features without restarting your bot
🛡️ Rate LimitingBuilt-in rate limit management per user/channel/guild
📝 TypeScriptFull type safety with intelligent autocomplete

📦 Installation

npm install @mostfeatured/dbi discord.js

🚀 Quick Start

1. Create DBI Instance

// dbi.jsconst{ createDBI }=require("@mostfeatured/dbi");constdbi=createDBI("my-bot",{strict: true,discord: {token: process.env.DISCORD_TOKEN,options: {intents: ["Guilds"]}},defaults: {locale: {name: "en"},directMessages: false}});module.exports=dbi;

2. Define Features

// src/commands/ping.jsconstdbi=require("../dbi");dbi.register(({ ChatInput })=>{ChatInput({name: "ping",description: "Check bot latency",onExecute({ interaction, dbi }){interaction.reply(`🏓 Pong! ${dbi.client().client.ws.ping}ms`);}});});

3. Start Bot

// index.jsconst{ Utils }=require("@mostfeatured/dbi");constdbi=require("./dbi");(async()=>{awaitUtils.recursiveImport("./src");awaitdbi.load();awaitdbi.login();console.log(`✅ Logged in as ${dbi.client().client.user.tag}`);})();

4. Publish Commands

// publish.jsconst{ Utils }=require("@mostfeatured/dbi");constdbi=require("./dbi");(async()=>{awaitUtils.recursiveImport("./src");awaitdbi.load();awaitdbi.publish("Global");// or dbi.publish("Guild", "GUILD_ID")awaitdbi.unload();console.log("✅ Commands published!");})();

💡 Examples

Slash Command with Options

dbi.register(({ ChatInput, ChatInputOptions })=>{ChatInput({name: "greet",description: "Greet a user",options: [ChatInputOptions.user({name: "target",description: "User to greet",required: true}),ChatInputOptions.string({name: "message",description: "Custom message"})],onExecute({ interaction }){constuser=interaction.options.getUser("target");constmessage=interaction.options.getString("message")||"Hello!";interaction.reply(`${message}, ${user}!`);}});});

Button with Reference Data

constDiscord=require("discord.js");dbi.register(({ ChatInput, Button })=>{ChatInput({name: "shop",description: "View the shop",onExecute({ interaction, dbi }){interaction.reply({content: "🛒 Welcome to the shop!",components: [{type: Discord.ComponentType.ActionRow,components: [dbi.interaction("buy-item").toJSON({overrides: {label: "Buy Sword - 100g"},reference: {data: ["sword",100]}})]}]});}});Button({name: "buy-item",options: {style: Discord.ButtonStyle.Primary},onExecute({ interaction, data }){const[item,price]=data;interaction.reply(`✅ You bought **${item}** for **${price}g**!`);}});});

Multi-Language Support

dbi.register(({ Locale, ChatInput })=>{Locale({name: "en",data: {greeting: "Hello, {0}!",farewell: "Goodbye!"}});Locale({name: "tr",data: {greeting: "Merhaba, {0}!",farewell: "Hoşça kal!"}});ChatInput({name: "hello",description: "Say hello",onExecute({ interaction, locale }){constgreeting=locale.user.data.greeting(interaction.user.username);interaction.reply(greeting);}});});

📚 Documentation

Comprehensive documentation is available in the docs folder:

DocumentDescription
Getting StartedInstallation, setup, and project structure
Chat InputSlash commands, options, and autocomplete
ComponentsButtons, select menus, and modals
EventsDiscord events, custom events, DBI events
LocalizationMulti-language support
Advanced FeaturesMessage commands, sharding, multi-client
Svelte ComponentsHTMLComponentsV2 with Svelte 5
API ReferenceComplete API documentation

🏗️ Project Structure

my-bot/
├── dbi.js # DBI configuration
├── index.js # Bot entry point
├── publish.js # Command publisher
└── src/
├── commands/ # Slash commands
├── components/ # Buttons, modals, menus
├── events/ # Event handlers
└── locales/ # Language files

🤝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


📄 License

GPL-3.0 © TheArmagan


"There will always be something free and valuable on earth."

Made with ❤️ by TheArmagan