I'm new to python but trying to learn some things with it and discord.py ... but I ran in to this error:
Ignoring exception in on_message
Traceback (most recent call last):
File "blabla/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
TypeError: on_message() takes 1 positional argument but 2 were given
And here is my code:
from discord.ext import commands
# Bot responses
class BotResponses(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(message):
if message.author == bot.user:
return
if message.content.startswith('hello'):
await message.channel.send('Hello')
await bot.process_commands(message)
def setup(bot):
bot.add_cog(BotResponses(bot))
Am I doing something that adds an argument or something? And if so, is there a way to prevent it?