zmxi92

make a core discord bot for a minecraft like dyno use / for the commands 🔧 Core System Features

These are must-haves for stability and usability:

Command handler Prefix or slash commands Command parsing + arguments Permissions system Admin / mod / user roles Command restrictions Error handling Graceful failure messages Logging errors for debugging Logging system Server events (joins, leaves, bans) Command usage logs Config system Per-server or per-user settings JSON / database storage 💬 User Interaction Features

These make your bot actually useful to people:

Help command Dynamic command list Categorized commands Ping / status Check bot latency & uptime User info Profile, roles, join date Server info Stats, creation date, member count 🛡️ Moderation Features

Critical for community bots:

Basic moderation Kick / ban / mute / timeout Auto-moderation Spam detection Word filters Link blocking Warning system Track user infractions Role management Auto roles Reaction roles ⚙️ Utility Features

Everyday helpful tools:

Reminders “Remind me in 2 hours” Timers Countdown / alarms Polls Voting system Custom commands Admin-defined responses 🎮 Fun & Engagement Features

Optional but popular:

Mini-games Memes / random content Leveling / XP system Economy system 🌐 Integrations

Make your bot powerful:

APIs (weather, news, etc.) Social media feeds Webhooks 🧠 Advanced Features (for scaling)

If you want a serious “core bot”:

Database integration PostgreSQL / MongoDB Modular architecture Load/unload features dynamically Rate limiting Prevent abuse Caching Improve performance Sharding (for Discord bots) Handle large scale 🏗️ Example “Minimal Core Bot”

If you want a starting checklist:

Command handler Help command Permissions Logging Error handling Basic moderation (kick/ban) Config system 💡 Pro Tip

Don’t try to build everything at once. Start with:

Core system + moderation + help command

Kodari AI
KodariMar 27 at 8:37 am 17,636 (v2)

I’ll create a comprehensive Discord bot with all the core features you requested, using slash commands and a modular architecture.

MinecraftCoreBot
A feature-rich Discord bot similar to Dyno, designed for Minecraft communities. Includes slash commands, moderation tools (kick/ban/warn/timeout), auto-moderation, leveling system, economy system, utility commands (reminders/polls), role management, custom commands, comprehensive logging, permissions system, and database integration. Built with a modular cog architecture for easy maintenance and scalability.

Created a comprehensive Discord bot with all requested features! Here’s what’s included:

Core System: Slash commands, modular cog architecture, permissions system, error handling, logging, and SQLite database

Moderation: Kick, ban, timeout, warnings with auto-ban, purge messages

User Features: Help, ping, user/server info, avatar display

Economy: Balance system, daily rewards, payments, leaderboard

Leveling: XP from messages, automatic level-ups, rank display, leaderboard

Utility: Reminders with flexible timing, interactive polls

Admin Tools: Custom commands, balance management, role management

Auto-Moderation: Spam detection, word filters, link blocking with whitelist

All commands use slash commands (/), data persists in SQLite, and the bot includes comprehensive logging and error handling. Configure config.json and add your bot token to .env to get started!

Kodari can make mistakes. Review important code before using.
Files
cogs
utils
bot.py
config.json
README.md
requirements.txt
Code
15 2,533
bot.py
import os
import sqlite3
import logging
import traceback
from datetime import datetime, timezone
from typing import Optional

import discord
from discord import app_commands
from discord.ext import commands
from dotenv import load_dotenv


# ============================================================
# CONFIG
# ============================================================

load_dotenv()

DISCORD_TOKEN = os.getenv("DISCORD_TOKEN", "").strip()

HUB_GUILD_ID = int(os.getenv("HUB_GUILD_ID", "1512783266305015898"))
CASES_FORUM_CHANNEL_ID = int(os.getenv("CASES_FORUM_CHANNEL_ID", "1513599222337900766"))
DEV_LOG_CHANNEL_ID = int(os.getenv("DEV_LOG_CHANNEL_ID", "1513593822700114031"))

HUB_REVIEWER_ROLE_ID = int(os.getenv("HUB_REVIEWER_ROLE_ID", "0"))
STAFF_ROLE_ID = int(os.getenv("STAFF_ROLE_ID", "0"))
SYNC_GUILD_ID = int(os.getenv("SYNC_GUILD_ID", "0"))

DB_PATH = "fairplay.sqlite"
LOG_FILE = "fairplay.log"

if not DISCORD_TOKEN:
    raise RuntimeError("Missing DISCORD_TOKEN in .env")


# ============================================================
# LOGGING
# ============================================================

logging.basicConfig(
    level=logging.INFO,
    format="[%(asctime)s] [%(levelname)s] %(name)s: %(message)s",
    handlers=[
        logging.FileHandler(LOG_FILE, encoding="utf-8"),
        logging.StreamHandler()
    ]
)

LOGGER = logging.getLogger("FairPlay")


# ============================================================
# HELPERS
# ============================================================

def utc_now() -> str:
    return datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")


def normalize_player(player: str) -> str:
    return player.strip().lower()


def short(text: Optional[str], limit: int = 1024) -> str:
    if text is None or str(text).strip() == "":
        return "None"

    text = str(text)

    if len(text) <= limit:
        return text

    return text[:limit - 3] + "..."


def has_role(member: discord.Member, role_id: int) -> bool:
    if not role_id:
        return False

    return any(role.id == role_id for role in member.roles)


def in_hub_guild(interaction: discord.Interaction) -> bool:
    return bool(interaction.guild and interaction.guild.id == HUB_GUILD_ID)


def can_use_public_staff_commands(interaction: discord.Interaction) -> bool:
    """
    For public servers: /report and /search.
    Default access is Discord staff-style permissions. You can also set STAFF_ROLE_ID.
    """
    user = interaction.user

    if not isinstance(user, discord.Member):
        return False

    if STAFF_ROLE_ID and has_role(user, STAFF_ROLE_ID):
        return True

    perms = user.guild_permissions
    return bool(perms.administrator or perms.manage_guild or perms.manage_messages)


def can_set_alert_channel(interaction: discord.Interaction) -> bool:
    """
    Server owners/admins can choose where their own server receives FairPlay alerts.
    """
    user = interaction.user

    if not isinstance(user, discord.Member):
        return False

    perms = user.guild_permissions
    return bool(perms.administrator or perms.manage_guild)


def can_use_hub_review_tools(interaction: discord.Interaction) -> bool:
    """
    Hidden hub tools: approve, deny, contact reporter, player history.

    These are not slash commands. They are only buttons on case posts in the hub forum.
    They only work inside HUB_GUILD_ID.
    """
    if not in_hub_guild(interaction):
        return False

    user = interaction.user

    if not isinstance(user, discord.Member):
        return False

    if HUB_REVIEWER_ROLE_ID and has_role(user, HUB_REVIEWER_ROLE_ID):
        return True

    perms = user.guild_permissions
    return bool(perms.administrator or perms.manage_guild or perms.manage_messages)


async def reply_ephemeral(
    interaction: discord.Interaction,
    content: Optional[str] = None,
    embed: Optional[discord.Embed] = None,
    view: Optional[discord.ui.View] = None
):
    if interaction.response.is_done():
        await interaction.followup.send(content=content, embed=embed, view=view, ephemeral=True)
    else:
        await interaction.response.send_message(content=content, embed=embed, view=view, ephemeral=True)


# ============================================================
# BOT
# ============================================================

class FairPlayBot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.default()

        super().__init__(command_prefix="!", intents=intents)

        self.db = sqlite3.connect(DB_PATH)
        self.db.row_factory = sqlite3.Row
        self.ready_once = False

    def init_db(self):
        self.db.executescript(
            """
            CREATE TABLE IF NOT EXISTS reports (
                id INTEGER PRIMARY KEY AUTOINCREMENT,
                forum_thread_id TEXT,
                forum_message_id TEXT,
                origin_guild_id TEXT,
                origin_guild_name TEXT,
                origin_channel_id TEXT,
                origin_channel_name TEXT,
                reporter_id TEXT NOT NULL,
                reporter_tag TEXT NOT NULL,
                player_key TEXT NOT NULL,
                player_name TEXT NOT NULL,
                reason TEXT NOT NULL,
                evidence TEXT NOT NULL,
                notes TEXT,
                status TEXT NOT NULL DEFAULT 'pending',
                duplicate_count INTEGER NOT NULL DEFAULT 0,
                created_at TEXT NOT NULL,
                reviewed_by_id TEXT,
                reviewed_by_tag TEXT,
                reviewed_at TEXT,
                review_notes TEXT
            );

            CREATE TABLE IF NOT EXISTS verified_cheaters (
                id INTEGER PRIMARY KEY AUTOINCREMENT,
                player_key TEXT NOT NULL UNIQUE,
                player_name TEXT NOT NULL,
                reason TEXT NOT NULL,
                evidence TEXT NOT NULL,
                report_id INTEGER,
                origin_guild_id TEXT,