• <small id='wIiUX'></small><noframes id='wIiUX'>

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

        <tfoot id='wIiUX'></tfoot>
        <legend id='wIiUX'><style id='wIiUX'><dir id='wIiUX'><q id='wIiUX'></q></dir></style></legend>

        如何使用 discord.py 获取不和谐用户的用户 ID

        时间:2023-09-09
        <i id='2SgYm'><tr id='2SgYm'><dt id='2SgYm'><q id='2SgYm'><span id='2SgYm'><b id='2SgYm'><form id='2SgYm'><ins id='2SgYm'></ins><ul id='2SgYm'></ul><sub id='2SgYm'></sub></form><legend id='2SgYm'></legend><bdo id='2SgYm'><pre id='2SgYm'><center id='2SgYm'></center></pre></bdo></b><th id='2SgYm'></th></span></q></dt></tr></i><div id='2SgYm'><tfoot id='2SgYm'></tfoot><dl id='2SgYm'><fieldset id='2SgYm'></fieldset></dl></div>

        <small id='2SgYm'></small><noframes id='2SgYm'>

        <legend id='2SgYm'><style id='2SgYm'><dir id='2SgYm'><q id='2SgYm'></q></dir></style></legend>
          1. <tfoot id='2SgYm'></tfoot>

              <tbody id='2SgYm'></tbody>

              • <bdo id='2SgYm'></bdo><ul id='2SgYm'></ul>
                • 本文介绍了如何使用 discord.py 获取不和谐用户的用户 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 Discord.py,并且我试图在用户输入频道时获取用户的 Discord 用户 ID.

                  Im using Discord.py and Im trying to get the Discord userid of a user when they type into a channel.

                  进入开发者模式可以找到userid,在用户名上右击,会有一个选项copy id".

                  The userid can be found when you go into developer mode, and right click on a username, there will be an option "copy id".

                  当前的 api 没有说明如何做到这一点,或者我一直错过它

                  The current api is not saying how to do this, or I keep missing it

                  推荐答案

                  文档说 User 类有用户的 id:
                  http://discordpy.readthedocs.io/en/latest/api.html#user

                  The documentation says that the User class have the user's id:
                  http://discordpy.readthedocs.io/en/latest/api.html#user

                  MemberUser 的子类:
                  http://discordpy.readthedocs.io/en/latest/api.html#member

                  因此,如果您收到来自用户的消息,则可以使用 message.author.id

                  So if you got a message from a user, you can get the id with message.author.id

                  import discord
                  import asyncio
                  
                  client = discord.Client()
                  
                  @client.event
                  async def on_ready():
                      print('Logged in as')
                      print(client.user.name)
                      print(client.user.id)
                      print('------')
                  
                  @client.event
                  async def on_message(message):
                      print(message.author.id)
                  
                  client.run('token')
                  

                  这篇关于如何使用 discord.py 获取不和谐用户的用户 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 discord.py 获取频道名称 下一篇:如何让我的 discord.py 机器人使用自定义表情符号

                  相关文章

                  最新文章

                • <legend id='nEB0c'><style id='nEB0c'><dir id='nEB0c'><q id='nEB0c'></q></dir></style></legend>

                • <tfoot id='nEB0c'></tfoot>

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

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

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