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

      <bdo id='DHYGr'></bdo><ul id='DHYGr'></ul>
    <tfoot id='DHYGr'></tfoot>

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

      1. 用 Python 编写 Discord 机器人 - 为什么它无法设置嵌

        时间:2023-10-10
          <tbody id='wtZmS'></tbody>

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

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

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

                  <legend id='wtZmS'><style id='wtZmS'><dir id='wtZmS'><q id='wtZmS'></q></dir></style></legend>
                • 本文介绍了用 Python 编写 Discord 机器人 - 为什么它无法设置嵌入图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个 meme 命令,它从 subreddit 获取 URL,然后将其设置为嵌入图像.这是我的代码:

                  I have a meme command that gets a URL from a subreddit and then sets it as an embed image. Here's my code:

                  memes = reddit.subreddit("memes")
                  memes_subs = []
                  memes_hot = memes.hot(limit = 50)
                  
                  for submission in memes_hot:
                    memes_subs.append(submission)
                  
                  
                  @client.command()
                  async def meme(ctx):
                    random_sub = random.choice(memes_subs)
                    name = random_sub.title
                    url = random_sub.url
                  
                    em = discord.Embed(title = name, color = 0xfdcb58)
                    em.set_footer(text = f"Requested by {ctx.message.author} | From r/memes")
                    em.set_image(url = url)
                  
                    await ctx.send(embed = em)
                  

                  有时嵌入没有图像,或者图像根本无法加载.我不确定为什么会发生这种情况,因此任何见解都将不胜感激.

                  Sometimes the embed does not have an image, or the image simply won't load. I am unsure why this happens, so any insight would be greatly appreciated.

                  推荐答案

                  一些 Imgur URL 以 gifv 结尾,因为它们是网页,而不是直接链接.要获取原始 GIF,您可以将链接更改为以下格式:http://i.imgur.com/12345.jpg
                  请注意 .jpg,而不是 .gif.不过,这会给你一个原始的 GIF 文件.

                  Some Imgur URLs end in gifv because they are web pages, not direct links. To get the original GIF, you can change the link into this format: http://i.imgur.com/12345.jpg
                  Note the .jpg, not a .gif. This will give you a raw GIF file though.

                  对于gfycat,可以使用替代链接格式https://thumbs.gfycat.com/ElatedEvergreenGoose-size_restricted.gif

                  For gfycat, The alternative link format https://thumbs.gfycat.com/ElatedEvergreenGoose-size_restricted.gif can be used

                  这篇关于用 Python 编写 Discord 机器人 - 为什么它无法设置嵌入图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:NameError: name 'client' is not defined 我该如何解 下一篇:403 Forbidden(错误代码:50001):添加角色时缺少访问权

                  相关文章

                  最新文章

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

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

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

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