I’m experiencing issues with my Discord bot not functioning as expected. I followed a guide for setting up a music bot, but whenever I attempt to use the /help command, I’m met with this error:
discord.ext.commands.bot: Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "help" is not found
Here’s what I have in my main bot file:
import discord
from discord.ext import commands
import os
from audio_cog import AudioCog
from commands_cog import CommandsCog
intents = discord.Intents.all()
client = commands.Bot(command_prefix="!", intents=intents)
client.remove_command('help')
async def load_commands(client):
await client.add_cog(CommandsCog(client))
async def load_audio(client):
await client.add_cog(AudioCog(client))
os.environ['BOT_TOKEN'] = 'your_token_here'
client.run(os.getenv('BOT_TOKEN'))
And here’s my commands_cog.py content:
from discord.ext import commands
class CommandsCog(commands.Cog):
def __init__(self, client):
self.client = client
self.command_list = """
Available Commands:
!help - Display all available commands
!start - Play music from YouTube
!list - Show current playlist
!next - Skip the current track
!stop - Stop playback and clear the playlist
!disconnect - Remove bot from the voice channel
!halt - Pause the current track
!continue - Resume playback
"""
self.channels = []
@commands.Cog.listener()
async def on_ready(self):
for server in self.client.guilds:
for text_ch in server.text_channels:
self.channels.append(text_ch)
await self.broadcast_message(self.command_list)
async def broadcast_message(self, msg):
for channel in self.channels:
await channel.send(msg)
@commands.command(name='help', help='Display all available commands')
async def show_help(self, ctx):
await ctx.send(self.command_list)
I’ve attempted various fixes, but nothing appears to resolve the issue. It seems like the cogs aren’t loading as they should. What am I overlooking?
Yeah, Sarah’s right - your cogs aren’t loading. But don’t fix this manually. Automate your whole Discord bot setup instead.
I’ve built several Discord bots for different teams. Managing bot commands and cogs manually becomes a nightmare when you scale up. Every time you want to add features or fix bugs, you’re editing code and redeploying.
Now I use Latenode to handle Discord interactions through webhooks and API calls. You can set up workflows that respond to Discord events, manage commands dynamically, and handle music streaming without voice channel headaches.
For your help command, create a simple HTTP endpoint in Latenode that responds with your command list. Then use Discord’s slash commands to call that endpoint. No more cog loading issues or command registration problems.
Best part? You can modify commands, add features, or fix bugs through Latenode’s visual interface without touching bot code. I’ve saved dozens of hours this way.
You’re calling client.run() right after defining your load functions without actually running them first. The bot starts before the cogs load, so your custom help command doesn’t exist yet.
I hit this same issue when I started with discord.py. Load your cogs before running the bot:
Ditch the client.run() line and use this instead. Your cogs will load properly before the bot connects to Discord. The key difference: run() handles the event loop automatically, but we need control over it to load cogs first.
the problem’s obvious - you defined the functions but never called them. your bot starts without loading any cogs, so the help command doesn’t exist. add asyncio.run(load_commands(client)) before the client.run() line and you’re good to go.
You’re removing the default help command but never loading the cogs where your custom help command lives. Your load_commands and load_audio functions exist but they’re never called anywhere.
You need to load the cogs when the bot starts up. Add this to your main file:
@client.event
async def on_ready():
await load_commands(client)
await load_audio(client)
print(f'{client.user} has connected to Discord!')
Or load them synchronously before running the bot with asyncio.run(). Without loading the cogs, your CommandsCog class never gets registered, so Discord can’t find the help command.
Also - watch out for that broadcast_message function in on_ready. It’ll spam every text channel the bot can access on startup, which could get you kicked from servers.
Your problem is you’re not actually loading the cogs. Had this same issue building my first music bot last year. The bot starts fine but can’t find commands because the cogs with those commands never got registered.
Skip the async main function others mentioned and try this:
Add this to a custom Bot subclass or use client.setup_hook if you’re on discord.py 2.0+. Cogs load during bot initialization instead of wrestling with the event loop manually.
Also, ditch that broadcast_message call in on_ready - it spams your command list to every channel when the bot starts. Server admins hate that.