Discord.py warning when you’re being robbed

I’m having trouble with this line of code… It doesn’t seem to work. It’s supposed to warn you when you are being robbed. It doesn’t work. Please help!

@client.event
async def on_message(message):
  if message.content.startswith('pls rob <@709809471571886112>'):
    await message.channel.send("<@709809471571886112> You're being robbed!")

  if message.content.startswith('pls rob <@717501219639132225>'):
    await message.channel.send("<@717501219639132225> You're being robbed!")

Answer

I see that you’re trying to be notified yourself when someone does pls rob <@709809471571886112>. Checking if a message starts with “pls rob <@709809471571886112>” isn’t reliable, because a user mention could be <@!ID> or <@ID>.

A more reliable way to define your function would be to check pls rob and your ID seperatly:

@client.event
async def on_message(message):
  if 'pls rob' in message.content and '709809471571886112' in message.content:
    await message.channel.send("<@709809471571886112> You're being robbed!")

  if 'pls rob' in message.content and '717501219639132225' in message.content:
    await message.channel.send("<@717501219639132225> You're being robbed!")

So basically, you don’t need to include the <@> between the IDs.