【问题标题】:Uploading a file in a embed discord.py (not a image)在嵌入的 discord.py 中上传文件(不是图像)
【发布时间】:2021-06-21 05:14:00
【问题描述】:

我正在尝试直接在嵌入中上传文件,我可以上传文件但我找不到将其放入嵌入中的方法。我想要的不是显示文件而是上传它以便我们可以下载它,是否可以嵌入? 谢谢

我可以将文件附加到嵌入中,但它不会将其放入嵌入中,它只是同时发送它

【问题讨论】:

    标签: python discord.py


    【解决方案1】:

    问题解决了,你不行,这里有另一种方式,更紧凑。

    @client.command()
    async def file(ctx, arg):
        file = discord.File(arg)
        embed = discord.Embed(title='Title', description='a description', color=0xfce303)
        await ctx.send(embed=embed, file=file)
    

    【讨论】:

      【解决方案2】:

      如果您想将文件放入嵌入中,这是不可能的,discord 本身不允许这样做。您可以同时发送文件和消息。方法如下:

      @client.command()
      async def name(ctx):
          embed = discord.Embed(colour=0x00000)
          embed.title = f"your title"
          embed.description = f"your desc"
          await ctx.send(embed=embed)
          await ctx.file.send("filename.txt")
      

      【讨论】:

        猜你喜欢
        • 2023-03-09
        • 2021-10-26
        • 2021-11-26
        • 2020-09-06
        • 2016-05-26
        • 2021-09-01
        • 2020-12-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多