所以,我有一个Python程序使用不和谐.py我试图让函数管理不同的消息命令,但是当我把“await”放在函数中时,它给了我一个语法错误,因为它不在async中。有什么办法可以让我绕开吗?你知道吗
def selectedCommand(message):
await client.send_message(stuff in here)
@client.event
async def on_message(message):
selectedCommand(message)
@client.event
async def on_edit_message(message):
selectedCommand(message)
您还需要使
selectedCommand
成为一个协程(一个async def
函数),然后在调用它时await
:相关问题 更多 >
编程相关推荐