onlyswift_

Create a professional Discord bot using Discord.js v14 (Node.js) with a modern structure.

Main Idea

When a user provides a Minecraft server IP, the bot automatically creates a private workspace (category + channels) dedicated to that server. The AI remembers the context of that server inside those channels so users can chat naturally about it.

Slash Command

"/analyze <server_ip>"

Example: "/analyze play.example.com"

Automatic Category Creation

After the command is used, create a category named:

"๐Ÿ“ <server-ip>"

Inside it, automatically create:

  • ๐Ÿ’ฌ chat
  • ๐Ÿ“‹ server-info
  • ๐Ÿ” analysis
  • ๐Ÿ”Œ plugins
  • โš™๏ธ recommendations

Only the user who ran the command and server administrators can view these channels.

Server Information

Immediately query the Minecraft server and display:

  • Server IP
  • Java/Bedrock detection
  • Version
  • MOTD
  • Online players
  • Max players
  • Ping
  • Server favicon (if available)

AI Chat

Inside ๐Ÿ’ฌ chat, users can ask anything naturally.

Examples:

  • What plugins should I install?
  • How do I reduce lag?
  • Why is PvP delayed?
  • Which anti-cheat is best?
  • Is Paper better than Purpur?
  • Explain LuckPerms.
  • Explain EssentialsX.
  • How can I optimize TPS?

The AI should remember the server context during that conversation.

Plugin Detection Rules

If plugins are publicly exposed or the bot has authorized access (such as RCON, FTP, or a panel API), then:

  • List installed plugins.
  • Explain what each plugin does.
  • Show plugin versions.
  • Detect outdated plugins.
  • Detect duplicate plugins.
  • Detect common compatibility problems.
  • Recommend replacements if needed.

If plugins cannot be detected from the IP alone, clearly say:

"I can't detect installed plugins from the server IP alone because the server does not expose that information."

Never guess or invent plugin names.

Analysis Channel

Generate a readable report including:

  • Performance observations
  • Version recommendations
  • Security suggestions
  • Plugin suggestions
  • Possible improvements

Recommendations Channel

Recommend plugins based on the detected server type.

Examples:

  • EssentialsX
  • LuckPerms
  • ViaVersion
  • ViaBackwards
  • Geyser
  • Floodgate
  • CoreProtect
  • WorldEdit
  • WorldGuard
  • Spark
  • Chunky

Explain why each recommendation is useful.

Features

  • Multiple server workspaces at once.
  • One category per server.
  • Persistent conversations.
  • Slash commands only.
  • Clean embeds.
  • Buttons and select menus where appropriate.
  • Error handling.
  • Rate limiting.
  • Logging.
  • Modular code.
  • Production-ready structure.

Important Rules

  • Never claim to know hidden plugins from only an IP.
  • Only analyze information that is actually available.
  • If additional access is required, tell the user exactly what is needed (RCON, FTP, or panel API).
  • Keep responses accurate and avoid making unsupported assumptions.
Kodari AI
KodariAug 1 at 8:49 am 2
ServerWorkspaceBot
A production-ready Discord.js v14 bot that creates private, persistent Minecraft server workspaces from the /analyze command. It queries Java and Bedrock status, publishes server details with MOTD, version, players, ping, and favicon, generates performance and security reports, provides platform-aware plugin recommendations, and supports contextual AI conversations. Permissions, rate limiting, structured logging, filesystem persistence, refresh controls, and strict safeguards prevent unsupported plugin claims.

Initialized ServerWorkspaceBot with:

  • Discord.js v14 slash command architecture

  • /analyze <server_ip> workspace creation

  • Private category and five dedicated channels

  • Java and Bedrock server querying

  • Persistent workspace and conversation storage

  • AI-powered contextual chat

  • Plugin detection safeguards

  • Analysis and recommendation embeds

  • Refresh button support

  • Administrator permissions

  • Rate limiting, logging, and error handling

  • Environment configuration and setup documentation

Kodari can make mistakes. Review important code before using.
Files
data
src
.gitignore
package.json
README.md
Code
21 1,232
src/index.js
require('dotenv').config();

const {
    Client,
    GatewayIntentBits,
    Partials
} = require('discord.js');
const { config, requireConfig } = require('./config');
const { createLogger } = require('./logger');
const { StorageService } = require('./storage');
const { MinecraftService } = require('./services/minecraftService');
const { PluginService } = require('./services/pluginService');
const { AiService } = require('./services/aiService');
const { RateLimiter } = require('./services/rateLimiter');
const { WorkspaceService } = require('./services/workspaceService');
const { createAnalysis, createRecommendations } = require('./services/reportService');
const { handleInteraction } = require('./events/interactionCreate');
const { handleMessage } = require('./events/messageCreate');

async function start() {
    requireConfig();

    const logger = createLogger(config.logLevel);
    const storage = new StorageService(config.dataDir);
    await storage.init();

    const client = new Client({
        intents: [
            GatewayIntentBits.Guilds,
            GatewayIntentBits.GuildMessages,
            GatewayIntentBits.MessageContent
        ],
        partials: [Partials.Channel]
    });

    const minecraftService = new MinecraftService();
    const pluginService = new PluginService();
    const aiService = new AiService(config, logger);
    const rateLimiter = new RateLimiter();
    const workspaceService = new WorkspaceService(storage, logger);

    workspaceService.logger.client = client;

    const services = {
        client,
        config,
        logger,
        storage,
        minecraftService,
        pluginService,
        aiService,
        rateLimiter,
        workspaceService,
        reportService: {
            createAnalysis,
            createRecommendations
        }
    };

    client.once('ready', () => {
        logger.info(`Logged in as ${client.user.tag}`);
    });

    client.on('interactionCreate', (interaction) => {
        handleInteraction(interaction, services).catch((error) => {
            logger.error('Interaction handling failed', error);
        });
    });

    client.on('messageCreate', (message) => {
        handleMessage(message, services).catch((error) => {
            logger.error('Message handling failed', error);
        });
    });

    client.on('error', (error) => logger.error('Discord client error', error));
    client.on('warn', (message) => logger.warn(`Discord warning: ${message}`));

    await client.login(config.token);
}

start().catch((error) => {
    console.error(error);
    process.exitCode = 1;
});