Discord bot command execution issue - no console errors but commands not responding

I’m working on a Discord bot for my trading community that should send notifications when I make trades. The bot starts up fine and shows no error messages in the terminal, but it completely ignores my !notify commands.

I’ve double checked all the bot settings in Discord’s developer portal and made sure the permissions are correct in my server. Here’s my code:

import discord
from discord.ext import commands

intents = discord.Intents.default()
client = commands.Bot(command_prefix='!', intents=intents)

@client.event
async def on_ready():
    print(f'Bot is online as {client.user}')

@client.command()
async def notify(ctx, trade_action, ticker, strike, contract_type, exp_date, cost):
    # Check if user has the required role
    if "traders" in [r.name for r in ctx.author.roles]:
        # Build the notification embed
        notification = discord.Embed(title="Trade Notification", color=0xff0000)
        notification.add_field(name="Action", value=trade_action, inline=False)
        notification.add_field(name="Ticker", value=ticker, inline=False)
        notification.add_field(name="Strike", value=strike, inline=False)
        notification.add_field(name="Type", value=contract_type, inline=False)
        notification.add_field(name="Expiry", value=exp_date, inline=False)
        notification.add_field(name="Cost", value=cost, inline=False)

        # Post to the alerts channel
        for server in client.guilds:
            for ch in server.text_channels:
                if ch.name == 'trade-alerts':
                    await ch.send(embed=notification)

        # Send DM to all traders
        for server in client.guilds:
            for user in server.members:
                if "traders" in [r.name for r in user.roles]:
                    await user.send(embed=notification)

client.run('your-bot-token')

Your code has issues beyond the intents problem. Six parameters is a lot for a Discord command - spaces and special characters mess things up. Start simple: make a basic command that just sends a message to confirm your bot receives commands at all. That nested loop searching for channels and users is terrible for performance and will hit rate limits fast. Cache the trade-alerts channel ID and store trader user IDs instead of searching through everything each time. Add some debug prints in your command function to see if it’s even firing.

Your intents setup is probably the issue. You’re using discord.Intents.default() which doesn’t include message content access anymore after Discord’s recent changes. Your bot sees messages exist but can’t read what’s in them to trigger commands.

Update your intents:

intents = discord.Intents.default()
intents.message_content = True
client = commands.Bot(command_prefix='!', intents=intents)

Don’t forget to enable “Message Content Intent” in your Discord app settings under the Bot section. This got me too when updating my bots - everything looked fine but commands wouldn’t work. Once you fix this, your notify command should respond.

make sure your bot can actually read messages in that channel. even with the right intents, it’ll fail if the bot role doesn’t have ‘read message history’ or ‘send messages’ permissions. try this simple test first: @client.command() async def test(ctx): await ctx.send('works') - that’ll tell you if your basic command setup is working.