<legend id='OLYMr'><style id='OLYMr'><dir id='OLYMr'><q id='OLYMr'></q></dir></style></legend>

    1. <i id='OLYMr'><tr id='OLYMr'><dt id='OLYMr'><q id='OLYMr'><span id='OLYMr'><b id='OLYMr'><form id='OLYMr'><ins id='OLYMr'></ins><ul id='OLYMr'></ul><sub id='OLYMr'></sub></form><legend id='OLYMr'></legend><bdo id='OLYMr'><pre id='OLYMr'><center id='OLYMr'></center></pre></bdo></b><th id='OLYMr'></th></span></q></dt></tr></i><div id='OLYMr'><tfoot id='OLYMr'></tfoot><dl id='OLYMr'><fieldset id='OLYMr'></fieldset></dl></div>

      1. <small id='OLYMr'></small><noframes id='OLYMr'>

      2. <tfoot id='OLYMr'></tfoot>
          <bdo id='OLYMr'></bdo><ul id='OLYMr'></ul>

        对于 discord.py,我如何将作者的 id 变成不和谐用

        时间:2023-10-11
      3. <tfoot id='umdSq'></tfoot>

              <bdo id='umdSq'></bdo><ul id='umdSq'></ul>

              • <i id='umdSq'><tr id='umdSq'><dt id='umdSq'><q id='umdSq'><span id='umdSq'><b id='umdSq'><form id='umdSq'><ins id='umdSq'></ins><ul id='umdSq'></ul><sub id='umdSq'></sub></form><legend id='umdSq'></legend><bdo id='umdSq'><pre id='umdSq'><center id='umdSq'></center></pre></bdo></b><th id='umdSq'></th></span></q></dt></tr></i><div id='umdSq'><tfoot id='umdSq'></tfoot><dl id='umdSq'><fieldset id='umdSq'></fieldset></dl></div>
                  <tbody id='umdSq'></tbody>

                  <small id='umdSq'></small><noframes id='umdSq'>

                • <legend id='umdSq'><style id='umdSq'><dir id='umdSq'><q id='umdSq'></q></dir></style></legend>
                  本文介绍了对于 discord.py,我如何将作者的 id 变成不和谐用户的真实姓名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在使用 message.author.id 时遇到问题.当我要求机器人返回用户 ID 时,它会返回...用户 ID.但这不是我想要的.我想让它说出用户的不和谐名称(例如,而不是像 13284701972315 那样,它会说 MyName #0000).我正在制作一个机器人,它会根据命令给出布朗尼点数.这是它可能会说的内容和示例.

                  I'm having trouble with message.author.id. When I ask a bot to return the user's ID, it returns the well... user ID. But that's not what I want. I want it to say the user's discord name (for an example, instead of like 13284701972315 it would say MyName #0000). I'm making a bot which will give out brownie points on command. Here's and example of what it might say.

                  311661286213550091 给@AceFTW 22 分.他们目前有 22布朗尼点!

                  311661286213550091 has given 22 brownie points to @AceFTW. They currently have 22 brownie points!

                  我想这样说:

                  @tristan360 给了@AceFTW 22 分.他们目前有 22布朗尼点!

                  @tristan360 has given 22 brownie points to @AceFTW. They currently have 22 brownie points!

                  我正在寻找一种让机器人显示用户名而不是用户 ID 的方法.

                  I'm looking for a way for the bot to display the user's name instead of the user's ID.

                  推荐答案

                  如果您已经有一个 Member 对象,则可以立即访问该名称.

                  If you have a Member object already, you can access the name straight away.

                  # member is <Member id=... name=MyName#0000>
                  member.name  # MyName
                  member.nick  # MyNick
                  member.display_name  # MyNick if nick is not None, else MyName
                  member.mention  # @MyName
                  str(member)  # MyName#0000
                  

                  如果您没有 Member 对象,但有 Guild(discord.py 0.x 中的 Server),您可以使用 Guild.get_member 方法.

                  If you do not have a Member object, but do have a Guild (Server in discord.py 0.x,) you can use the Guild.get_member method.

                  member = guild.get_member(userID)
                  member.name  # MyName
                  

                  如果您根本没有任何信息,可以使用 Client.get_user_info 方法.请注意,这将返回 User 而不是 Member,因此您将无法访问昵称、角色等.

                  If you don't have any information at all starting, you can use the Client.get_user_info method. Note, this returns a User not a Member, so you will not have access to nicknames, roles, etc.

                  user = bot.get_user_info(userID)
                  user.name  # MyName
                  user.nick  # Error
                  

                  这篇关于对于 discord.py,我如何将作者的 id 变成不和谐用户的真实姓名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如果消息被编辑,反发誓系统不起作用 下一篇:discord.py 中的命令冷却时间

                  相关文章

                  最新文章

                  <i id='B06KR'><tr id='B06KR'><dt id='B06KR'><q id='B06KR'><span id='B06KR'><b id='B06KR'><form id='B06KR'><ins id='B06KR'></ins><ul id='B06KR'></ul><sub id='B06KR'></sub></form><legend id='B06KR'></legend><bdo id='B06KR'><pre id='B06KR'><center id='B06KR'></center></pre></bdo></b><th id='B06KR'></th></span></q></dt></tr></i><div id='B06KR'><tfoot id='B06KR'></tfoot><dl id='B06KR'><fieldset id='B06KR'></fieldset></dl></div>
                        <bdo id='B06KR'></bdo><ul id='B06KR'></ul>
                    1. <small id='B06KR'></small><noframes id='B06KR'>

                    2. <legend id='B06KR'><style id='B06KR'><dir id='B06KR'><q id='B06KR'></q></dir></style></legend>
                    3. <tfoot id='B06KR'></tfoot>