'I keep getting a 'missing 1 required positional argument' error

I have been making a discord autoresponder bot with python and I keep getting an error message.

TypeError: on_message() missing 1 required positional argument: 'msg'

@bot.event
async def on_message(ctx, msg):
    msg.content = msg.content.lower()
    if "hi" in msg.content:
        await ctx.send ("Hi, I guess")


Solution 1:[1]

The on_message event doesn't have a ctx parameter, if you want to reply to the invoking message or send to the same channel, you should use await msg.channel.send

Docs

So your event should look more like

async def on_message(msg):

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zeehyt