如何从discord.py中的提及中吸引用户?

时间:2018-08-17 19:57:09

标签: python-3.x discord discord.py

我的命令有问题,由于某种原因,该命令昨晚起作用,但现在仅当我提及自己的用户名时,该命令才起作用。我可以正确使用user=message.mentions[0]吗?

@client.async_event
async def on_message(message):
    if message.author == client.user:
        return
    elif message.content.startswith('!punch'):
        user = message.mentions[0]
        responses = ['DANG ' + user.mention + ' just got punched!', 'LOOK OUT ' + user.mention + ' just got knocked out! ლ(ಠ益ಠლ)', 'trong uppercut right in ' + user.mention + 's chin']
        choice = random.choice(responses)
        await client.send_message(message.channel, choice)

0 个答案:

没有答案