send() 需要 1 到 2 个位置参数,但给出了 3 个 (discord.py)

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)

mou*_*ail 6

channel.send() 只接受一个参数(以及使它看起来像 2 的隐式自我)

你可以这样写:

await message.channel.send(f'{message.author.mention} is blessed by ...')
Run Code Online (Sandbox Code Playgroud)