@client.event
async def on_message(message,channel):
if message.content.startswith("sa"):
await channel.send(message.channel, "as")
await client.process_commands(message)
这段代码应该as在我说的时候说sa。它检测到这个词,但没有响应。这是我得到的错误:
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\---\PycharmProjects\discordmasterbot\venv\lib\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
TypeError: on_message() missing 1 required positional argument: 'channel'
我在想这可能是一个过时的代码,所以我试图尽可能地改变它,但我收到了那个错误。
@client.event
async def on_message(message):
if message.content.startswith('sa'):
await message.channel.send('as')
await client.process_commands(message)
翻过高山走不出你
相关分类