如何让我的不和谐机器人在 py 中提及没有 ID 的人?

时间:2021-04-24 05:52:24

标签: python

我试过了,但它只能回答特定的人

message.author == client.user: 返回

if message.content.startswith('slap <@!479915823897640972>'): 等待 message.channel.send( "{0.author.mention} 拍了 <@!479915823897640972>".format(message))

1 个答案:

答案 0 :(得分:0)

我建议使用命令。 如果你这样做,它会是这样的:

@commands.command() # This can be whatever you bot variable is
async def slap(self, ctx, user): # You can change the name to whatever
    await ctx.send(f"{ctx.author.mention} slapped {user}") # The only issue is that the user can be anything, from a number to a word, and not always a mention