问题描述
颜色角色
@bot.event
async def on_message(ctx,message):
await bot.process_commands()
user = ctx.message.author
msg = message.content.lower
role = discord.utils.get(discord.guild.roles,name = "blue as alian egg")
if msg == ['I am blue']:
await user.add_roles(role)
这是我的错误:
C:\Users\Егор\AppData\Local\Programs\Python\python38-32\python.exe C:/Users/Егор/PycharmProjects/Luiji/Luiji.py
Luiji is ready to work!
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Егор\AppData\Local\Programs\Python\python38-32\lib\site-packages\discord\client.py",line 312,in _run_event
await coro(*args,**kwargs)
TypeError: on_message() missing 1 required positional argument: 'message'
解决方法
on_message
没有ctx,应该是
async def on_message(message):
这就是错误on_message() missing 1 required positional argument: 'message'
的含义,您有一个额外的参数message。