我尝试将本地设备中的文件添加到discord.py嵌入中。下面是我的代码,虽然它不能工作,但请帮助我
import discord
from discord.ext import commands
client = commands.Bot(command_prefix="!")
@client.command
async def pika(ctx):
file = discord.File("E:\Python\discord.py\Pikachu1.jpg", filename="image.jpg")
embed = discord.Embed(color=0xFFFFFF)
embed.set_image(url="E:\Python\discord.py\Pikachu1.jpg")
await ctx.send(file=file, embed=embed)发布于 2021-10-21 11:24:08
要将本地文件用于嵌入的图像,请使用Discord的attachment://协议。(归于Lukasz)。
file = discord.File("path/to/my/image.png", filename="image.png")
embed = discord.Embed()
embed.set_image(url="attachment://image.png")
await channel.send(file=file, embed=embed)https://stackoverflow.com/questions/69655938
复制相似问题