message.content.startswith Discord.Py

Viewed 11388
@client.event
async def on_message(message):
    await client.process_commands(message)
    if message.content.startswith('sa'):
        await message.channel.send('as')

This is my code. It should say as when I say sa. It works fine but when I write salah or anything that starts with sa, it detects it and responds. It shouldn't work like that. I read the documentation but couldn't find anything, I know that it is becuse of .startswith but I can't find any replacement for it.

1 Answers

As explained in the comments, if you want to compare equality between strings, then:

if message.content == 'sa':
Related