+
Skip to content

Szmelc-INC/Universal-Discord-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Universal Discord Bot (Node.js)

A modular Discord bot rewritten in Node.js with modern slash commands and dynamic module loading.

Features

  • 📦 Each module is a standalone .js file located in modules/.
  • 🧩 Automatic registration of slash commands with autocomplete support.
  • 🏗️ CLI interface to start bots and manage modules.
  • 🏷️ Runtime --bot flag to start a specific bot directly.
  • 🔒 Bot tokens loaded from .discordrc (gitignored).

Getting Started

npm install

Create a .discordrc file with your tokens:

{
  "bot1": "YOUR_TOKEN"
}

Never commit this file. The .gitignore already excludes it.

Configure your bots in botconfig.json (modules, admins, blacklist). The keys should match the names in .discordrc.

botconfig.json also provides response limits and how to handle content that exceeds them:

"limits": {
  "maxMessageLength": 2000,
  "maxFileSize": 10485760,
  "maxFiles": 10,
  "strategy": "truncate" // or "split" / "file"
}

Use split to send long output in multiple messages or file to upload it as a text file.

Run the bot with:

# Interactive menu (lists bots from `.discordrc`)
node main.js

# Start directly by name
node main.js --bot bot1

# Save console output to a log file
node main.js --bot bot1 --log

Creating Modules

A module exports a slash command definition and logic:

const { SlashCommandBuilder } = require('discord.js');

module.exports = {
  data: new SlashCommandBuilder().setName('ping').setDescription('Pong'),
  async execute(interaction) {
    await interaction.reply('Pong!');
  }
};

Place the file in the modules/ directory and enable it through the CLI.


"Not as good as other bots, but good enough!"

About

A modular approach to Discord bots

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载