send()需要1到2个位置参数,但给出了3个(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')
回答
channel.send() 只接受一个参数(以及使它看起来像 2 的隐式自我)
你可以这样写:
await message.channel.send(f'{message.author.mention} is blessed by ...')