n3t_rico

Hey kodari! I want a bot that can produce commands like ban kick warn time out soft ban mute server vc's Lock vc's more. Make the embeds nice when buttons are chosen.

Kodari AI
KodariJun 30 at 8:08 pm 1
ModBot
A full-featured Discord moderation bot with commands for ban, kick, warn, timeout, softban, mute, and voice channel management. Features include confirmation buttons on moderation actions, a warning tracking system, rich embed responses, serverinfo with detailed statistics, VC listing/locking, configurable mute role and modlog channel, and a categorized help command.

Creating the ModBot — a Discord moderation bot with nice embeds and button interactions.

Let me start with the foundation files, then the cogs.

Starting fresh — creating ModBot from scratch.

ModBot
A powerful Discord moderation bot with customizable moderation commands. Features include ban, kick, warn, timeout, softban, mute/unmute with confirmation buttons, warning tracking with JSON storage, voice channel listing and locking, and a detailed serverinfo command. All actions respond with polished embeds. Configurable mute role and modlog channel. Built with discord.py and slash-ready command structure.

Creating the project structure:

Creating all project files now.

All files created. Here’s what ModBot includes:

Commands:

  • Moderation: kick, ban, softban, timeout (with duration parsing like 10m, 1h, 2d), unmute, warn, warnings, clearwarns, purge, slowmode

  • Voice: vcs (list all VCs with members), lockvc / unlockvc, movevc, disconnectvc

  • Info: serverinfo (channels/roles/members/boosts/created), userinfo, botinfo, help

Key features:

  • ✅ Confirmation buttons on ban/kick/timeout/softban/mute/unmute — Confirm (red) and Cancel (grey) buttons, times out after 60s

  • ✅ Rich embeds everywhere — color-coded (red=danger, green=success, gold=warnings, orange=kick, purple=softban), author avatar, moderator/reason/duration fields, footer with version

  • ✅ Warning system — per-guild JSON storage, tracking reason/moderator/timestamp, warnings and clearwarns commands

  • ✅ Mod-log channel — actions logged to a channel named mod-log (configurable in config.json)

  • ✅ DM notifications — users get a DM with the action details

  • ✅ Role hierarchy checks — can’t moderate yourself or higher roles

  • ✅ Error handling — permission, member not found, invalid argument errors return clean embeds

  • ✅ Categorized help — !help shows all commands grouped, !help <command> shows details + aliases

To use: Set your token in .env, run pip install -r requirements.txt, then python bot.py.

Kodari can make mistakes. Review important code before using.
Files
__init__.py
__init__.py
bot.py
config.json
helpers.py
info.py
moderation.py
requirements.txt
voice.py
Code
9 832
/home/user/ModBot/bot.py
import discord
from discord.ext import commands
import os
import asyncio
from dotenv import load_dotenv
from utils.helpers import load_config

load_dotenv()

TOKEN = os.getenv("DISCORD_TOKEN")
if not TOKEN:
    raise ValueError("DISCORD_TOKEN not found in .env file. Please set it.")

config = load_config()
prefix = config.get("prefix", "!")

intents = discord.Intents.all()
bot = commands.Bot(command_prefix=prefix, intents=intents, help_command=None)

@bot.event
async def on_ready():
    print(f"Logged in as {bot.user} (ID: {bot.user.id})")
    print(f"Connected to {len(bot.guilds)} guild(s)")
    print(f"Prefix: {prefix}")
    await bot.change_presence(
        activity=discord.Activity(
            type=discord.ActivityType.watching,
            name=f"for {prefix}help"
        )
    )

async def load_extensions():
    cogs = [
        "cogs.moderation",
        "cogs.voice",
        "cogs.info"
    ]
    for cog in cogs:
        try:
            await bot.load_extension(cog)
            print(f"Loaded extension: {cog}")
        except Exception as e:
            print(f"Failed to load extension {cog}: {e}")

async def main():
    async with bot:
        await load_extensions()
        await bot.start(TOKEN)

if __name__ == "__main__":
    asyncio.run(main())