0

I am trying to add a feature to my bot which would send messages if it detects a keyword. Such as, keyword = ["Hello There"] User: Hello There \Bot: Hi!

client = commands.Bot(command_prefix=".")
.
.
.
@client.event
async def on_message(ctx):
    if ctx.author == client.user:
        return
    keywords = ["Hey","","Hi","Hello"]
    channel = ctx.channel
    for keyword in keywords:
        if keyword.lower() in ctx.content.lower():
            response = ("Hello sir!")
            await channel.send(response)

I am using this code for that but whenever I add this part to my code, other commands fail to proccess however this and other events are totally working fine

1 Answers1

1

You should be able to use await client.process_commands(ctx) at the end of on_message() to put the message through to the @client.command() section.

Gian Gisin
  • 24
  • 5