Why is my discord bot outputting different commands twice
07:58 10 Dec 2025

I am having some problems regarding the bot, when I type !a helpit shows the same output twice, instead of showing it once Code:

Python Screenshot output

Bot running same commands twice

Link: Main.py:

# main.py
import os
import asyncio
import dotenv
import discord
from discord.ext import commands
import db

dotenv.load_dotenv("bot.env")

intents = discord.Intents.default()
intents.members = True
intents.message_content = True
intents.guilds = True

b = commands.Bot(command_prefix="!a ", intents=intents)

async def load_cogs():
    for filename in os.listdir("./cogs"):
        if filename.endswith(".py"):
            await b.load_extension(f"cogs.{filename[:-3]}")
    print("✅ All cogs loaded")

@b.event
async def on_ready():
    print(f"✅ Bot online as {b.user}")
    # Check for duplicate commands
    all_commands = list(b.commands)
    command_names = [cmd.name for cmd in all_commands]
    duplicates = [name for name in command_names if command_names.count(name) > 1]
    
    if duplicates:
        print(f"🚨 DUPLICATE COMMANDS FOUND: {duplicates}")
    else:
        print(f"✅ No duplicate commands. Total: {len(all_commands)}")
    
    # List all commands
    for cmd in all_commands:
        print(f"  - {cmd.name} (cog: {cmd.cog_name if cmd.cog else 'None'})")

async def main():
    db.init_db()
    await load_cogs()
    await b.start(os.getenv("DISCORD_TOKEN"))

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

Link: Moderation.py:

https://gist.github.com/JuanGomezBot/6d80076d5eec24250a55a5a24484f6f1 (Code is too long to be shown here)

I tried to use chatgpt but their memory is terrible, and deepseek thinks for a looong time leading to no solution

python discord.py