Mentions are stored in an attribute named message.mentions
if discord.utils.get(message.server.members, '435379055253127178') in message.mentions:
text = await client.send_message(message.channel, "**Baking a cake**")
await client.send_message(message.channel, "**Baking a cake**")
await client.edit_message(text, "Hi i'm cake bot nice to meet you!")
But if you want to check mentions manually instead, there's sometimes a ! in between the @ and id and they are wrapped by <>. I would use a regex:
from re import match
if match("<@!?435379055253127178>", message.content) is not None:
text = await client.send_message(message.channel, "**Baking a cake**")
await client.send_message(message.channel, "**Baking a cake**")
await client.edit_message(text, "Hi i'm cake bot nice to meet you!")
This will check if the mention of the user is at the front of the message, similar to what you were trying to do. Since .mentions
keeps a unordered list of all mentioned users.
Btw, if the id is the bot's, you could don't have to hard code the id.
if client.user in message.mentions:
...