1

What im trying to do: I want my bot to send a message when its mentioned, i don't wanna use it as prefix just send a single message when mentioned.

My problem: It only reacts to the when_mentioned and will not react to the normal commands.

What i have tried:

@client.event
async def on_message(message):
  if client.user.mentioned_in(message):
    embed=discord.Embed(title=f"title)", color=0x7289da)
    embed.set_thumbnail(url=thumbnailurl")
    await message.channel.send(embed=embed)
Rensjuh
  • 81
  • 2
  • 9
  • 1
    When you modify the main `on_message` handler, you have to add a call to `process_commands(...)` https://stackoverflow.com/questions/49331096/why-does-on-message-stop-commands-from-working – effprime Feb 16 '21 at 17:15

2 Answers2

0

try it:

@bot.event
async def on_message(msg):
    if msg.mentions[0] == bot.user:
        embed=discord.Embed(title="title",
                            description=f'My prefix is `{bot.get_prefix(msg)}`',
                            color=0x7289da)
        embed.set_thumbnail(url="thumbnailurl")
        await message.channel.send(embed=embed)
-1
@client.event
async def on_message(message):
  if message.mentions[0] == client.user:
    embed=discord.Embed(title=f"title)", color=0x7289da)
    embed.set_thumbnail(url=thumbnailurl")
    await message.channel.send(embed=embed)
  await client.process_commands(message)
Nicholas Chen
  • 144
  • 1
  • 11