Apr*_*han 1 python discord discord.py
我试图让它说出执行~milk的用户的名字,它只会在你输入 discord ~milk时产生错误, 这里是产生错误的代码:
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('~milk'):
await message.channel.send(message.author, 'is blessed by the Baltic Gods of Dairy')
Run Code Online (Sandbox Code Playgroud)
channel.send() 只接受一个参数(以及使它看起来像 2 的隐式自我)
你可以这样写:
await message.channel.send(f'{message.author.mention} is blessed by ...')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
382 次 |
| 最近记录: |