L

Create a professional Discord Anti-Spam Bot for my Minecraft Discord server "BlockFun".

Bot Name: BlockFun Guard Developer: Nawaz Ahmad

Requirements:

  • Use Discord.js v14
  • Use Node.js 22+
  • Use Slash Commands
  • Store settings in JSON (no database required)
  • Well-structured folders (commands, events, handlers, utils, config)

Main Features:

🛡️ Anti-Spam System

  • Detect if a member sends 5 messages within 5 seconds.
  • Automatically delete the spam messages.
  • Timeout the member for 10 minutes.
  • Send a warning message mentioning the user.
  • Log the action in #mod-logs.

🔁 Duplicate Message Detection

  • If a member sends the same message 3 times in a row:

- Delete the messages. - Timeout for 10 minutes.

😀 Emoji Spam Detection

  • Detect excessive emoji spam.
  • Delete the message.
  • Timeout for 5 minutes.

🔤 CAPS Spam

  • Detect messages with excessive capital letters.
  • Delete the message.
  • Warn the user.
  • Timeout after repeated offenses.

👥 Mention Spam

  • Detect mass mentions (@everyone, @here, or many users).
  • Delete the message.
  • Timeout for 15 minutes.

🔗 Link Protection

  • Block invite links and suspicious URLs.
  • Delete the message.
  • Timeout after repeated violations.

📂 Attachment Spam

  • Detect users sending too many images/files quickly.
  • Delete the attachments.
  • Timeout for 10 minutes.

⚡ Smart Detection

  • Ignore Team Leader, Admin, Moderator, and Bot roles.
  • Ignore bots completely.
  • Do not punish users for normal conversations.
  • Reset spam counters automatically after a short time.

📝 Logs Log every moderation action:

  • User
  • Reason
  • Timeout Duration
  • Timestamp
  • Moderator: BlockFun Guard

Slash Commands: /antispam enable /antispam disable /antispam settings /antispam whitelist add /antispam whitelist remove /antispam status

Configuration:

  • Spam limit
  • Duplicate limit
  • Emoji limit
  • Mention limit
  • Attachment limit
  • Timeout duration
  • Log channel ID
  • Whitelisted roles

Error Handling:

  • Never crash.
  • Handle missing permissions gracefully.
  • Show readable console logs.

Performance:

  • Fast and lightweight.
  • Memory optimized.
  • Suitable for servers with 10,000+ members.

Deliver the complete production-ready source code with:

  • package.json
  • index.js
  • config.json
  • commands/
  • events/
  • handlers/
  • utils/
  • README.md
  • Installation Guide
  • Proper comments throughout the code.
Kodari AI
KodariAug 7 at 2:53 pm 2
BlockFunGuard
BlockFunGuard is a professional Discord anti-spam bot for Minecraft servers. It detects and automatically handles spam messages, duplicate content, emoji floods, excessive caps, mass mentions, suspicious links, and attachment spam. The bot automatically deletes offending messages, applies timed timeouts, and logs all moderation actions to a designated channel. It features smart role-based exemptions, configurable limits, whitelist management, and slash commands for enabling/disabling protection and viewing settings. Built with Discord.js v14 and JSON storage, it's lightweight, crash-resistant, and optimized for servers with 10,000+ members.
  1. Create the Node.js/discord.js project foundation and configuration.

  2. Add JSON settings storage, detection logic, moderation, and logging utilities.

  3. Add slash command, event, and handler wiring for the complete bot lifecycle.

  4. Add installation and operations documentation.

  1. Built the complete BlockFun Guard Discord.js v14 bot for Node.js 22+.

  2. Added anti-spam detection for rapid messages, duplicates, emojis, CAPS, mentions, links, and attachments.

  3. Added automatic deletion, warnings, configurable timeouts, role/bot exemptions, and moderation logging.

  4. Added /antispam slash commands for enable, disable, settings, status, and role whitelisting.

  5. Added JSON-based persistent settings, structured handlers/events/utils folders, error handling, and production installation documentation.

L

How to download

Kodari AI
KodariAug 7 at 2:55 pm 1

What would you like to download—BlockFun Guard, Node.js, Discord.js, or something else?

If you mean the BlockFun Guard bot, tell me where you want to run it (Windows, Linux/VPS, or hosting panel), and I’ll explain the download and setup steps without writing code.

Kodari can make mistakes. Review important code before using.
Files
commands
data
events
handlers
utils
config.json
index.js
package.json
README.md
Code
18 822
index.js
require('dotenv').config();

const { Client, GatewayIntentBits, Partials } = require('discord.js');
const config = require('./config.json');
const { loadCommands } = require('./handlers/commandHandler');
const { loadEvents } = require('./handlers/eventHandler');
const SettingsStore = require('./utils/settingsStore');
const AntiSpamHandler = require('./handlers/antiSpamHandler');
const logger = require('./utils/logger');

const token = process.env.DISCORD_TOKEN;

if (!token || token === 'replace_with_your_bot_token') {
  logger.error('DISCORD_TOKEN is missing. Copy .env.example to .env and add your bot token.');
} else {
  const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent
  ],
  partials: [Partials.Channel]
  });

  // Shared services are attached to the client so every event uses one store and detector.
  client.commands = loadCommands();
  client.settingsStore = new SettingsStore();
  client.antiSpam = new AntiSpamHandler(client);

  loadEvents(client);

  process.on('unhandledRejection', (error) => logger.error('Unhandled promise rejection:', error));
  process.on('uncaughtException', (error) => logger.error('Uncaught exception:', error));

  client.login(token).catch((error) => logger.error('Unable to log in to Discord:', error));
}