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

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

      <tfoot id='PYgnL'></tfoot>
        • <bdo id='PYgnL'></bdo><ul id='PYgnL'></ul>
        <legend id='PYgnL'><style id='PYgnL'><dir id='PYgnL'><q id='PYgnL'></q></dir></style></legend>
      1. 在 discord.py 中访问成员的横幅

        时间:2023-10-11

        <small id='7FnU8'></small><noframes id='7FnU8'>

          <legend id='7FnU8'><style id='7FnU8'><dir id='7FnU8'><q id='7FnU8'></q></dir></style></legend><tfoot id='7FnU8'></tfoot>

              <bdo id='7FnU8'></bdo><ul id='7FnU8'></ul>

                <tbody id='7FnU8'></tbody>

                1. <i id='7FnU8'><tr id='7FnU8'><dt id='7FnU8'><q id='7FnU8'><span id='7FnU8'><b id='7FnU8'><form id='7FnU8'><ins id='7FnU8'></ins><ul id='7FnU8'></ul><sub id='7FnU8'></sub></form><legend id='7FnU8'></legend><bdo id='7FnU8'><pre id='7FnU8'><center id='7FnU8'></center></pre></bdo></b><th id='7FnU8'></th></span></q></dt></tr></i><div id='7FnU8'><tfoot id='7FnU8'></tfoot><dl id='7FnU8'><fieldset id='7FnU8'></fieldset></dl></div>
                  本文介绍了在 discord.py 中访问成员的横幅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在制作图像配置文件命令.我想为此访问会员的横幅.有什么方法可以在 discord.py 中做到这一点?

                  I am making an image profile command. I would like to access the member's banner for this. Is there any way we can do that in discord.py?

                  如果不清楚我所说的横幅是什么意思,那么带有蓝色背景的图像就是横幅.我想访问它.

                  If it is not clear what i mean by banner then, the image with the blue background is the banner. I would like to access that.

                  推荐答案

                  discord.py v2.0可以使用

                  In discord.py v2.0 you can use

                  # You may have to re-fetch the user for the banner to work properly
                  user = await bot.fetch_user(user.id)
                  banner_url = user.banner.url # The URL of the banner
                  

                  在v2.0之前,有一种hacky方式可以直接使用API​​获取banner

                  Before v2.0, there is a hacky way to get the banner by directly using the API

                  req = await bot.http.request(discord.http.Route("GET", "/users/{uid}", uid=user.id))
                  banner_id = req["banner"]
                  if banner_id:
                      banner_url = f"https://cdn.discordapp.com/banners/{user.id}/{banner_id}?size=1024"
                  else:
                      # The user doesn't have a banner, do what you want
                      # In many forks, User.accent_color exists so you
                      # may want to check if your library supports that first
                      pass
                  

                  要安装 discord.py v2.0,您应该运行

                  To install discord.py v2.0 you should run

                  pip install -U git+https://github.com/Rapptz/discord.py
                  

                  这篇关于在 discord.py 中访问成员的横幅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何创建一个新的私人文本频道并添加 2 个人? 下一篇:Python discord.py 阅读全文

                  相关文章

                  最新文章

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

                  • <bdo id='KqhvX'></bdo><ul id='KqhvX'></ul>

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

                      <tfoot id='KqhvX'></tfoot>