Finding author of a message

前端 未结 3 573
一生所求
一生所求 2021-01-20 14:49

If someone writes \"?name (arg)\" I want my bot to say the author of the message + \", your name is\" + arg. I can\'t find of the author of the message thou

3条回答
  •  渐次进展
    2021-01-20 15:41

    You can also use User.display_name, which will try to to use the users server-specific nickname, but will fall back to the general username if that is not found:

    @client.command(pass_context=True)
    async def name(ctx):
        username = ctx.message.author.display_name
    

提交回复
热议问题