【发布时间】:2021-12-07 20:41:32
【问题描述】:
我尝试将本地设备中的文件添加到 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)
【问题讨论】:
-
请准确解释这里不工作的地方。也许您也可以发布回溯?
-
别想了,你只设置颜色和添加图像。难道 embed 有必需的参数?试试
embed = discord.Embed(color= 0xFFFFFF, title="test")。请添加更多关于其他人所说的不起作用的信息。 -
再试一试,将
@client.command更改为@client.command()
标签: python error-handling discord discord.py