我绝对无法让我的机器人在 python 中发送嵌入消息
I absolutely cannot get my bot to send a embed message in python
我绝对找不到解决这个问题的方法,这是我尝试做的:
@client.command(aliases=['Info','information','Information'])
async def info(ctx):
embed=discord.Embed(title="Info", description="This menu displays the info about this bot", color=#fff300())
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.add_field(name="placeholder", value="another placeholder", inline=False)
embed.add_field(name="so much placeholder", value="Bit more placeholder", inline=False)
embed.add_field(name="(placeholder text)", value="(placeholder text)", inline=True)
embed.add_field(name="way too much placeholder", value="some more placeholder", inline=True)
embed.add_field(name="more placeholder", value="placeholder", inline=False)
await ctx.send(embed=embed)
我什至使用了所有可能的网站,甚至是最新的网站,但我找不到任何方法来修复错误,我不断收到语法错误,但无论如何我都找不到修复它,
初始化嵌入时语法错误
embed = discord.Embed(..., color=#fff300())
python 中的评论以 #
开头,要修复它只需将其放在引号中
color="fff300"
注意:这行不通,您需要将其转换为基数为 16 的整数(也是 colour
而不是 color
):
colour=int("fff300", 16)
# Or as `Nurqm` suggested
colour=0xfff300
embed = discord.Embed(title="Info", description="This menu displays the info about this bot", colour=int("fff300", 16))
@client.command()
async def info(ctx):
embed = discord.Embed(title="Info", description="This menu displays the info about this bot", color=0xa3a3ff)
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.add_field(name="placeholder", value="another placeholder", inline=False)
embed.add_field(name="so much placeholder", value="Bit more placeholder", inline=False)
embed.add_field(name="(placeholder text)", value="(placeholder text)", inline=True)
embed.add_field(name="way too much placeholder", value="some more placeholder", inline=True)
embed.add_field(name="more placeholder", value="placeholder", inline=False)
await ctx.send(embed=embed)
我看到的是一些缩进(间距)错误和颜色格式错误。除此之外,我几乎没有看到任何错误,它应该可以工作,如果没有,请告诉我们您正面临什么错误
我绝对找不到解决这个问题的方法,这是我尝试做的:
@client.command(aliases=['Info','information','Information'])
async def info(ctx):
embed=discord.Embed(title="Info", description="This menu displays the info about this bot", color=#fff300())
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.add_field(name="placeholder", value="another placeholder", inline=False)
embed.add_field(name="so much placeholder", value="Bit more placeholder", inline=False)
embed.add_field(name="(placeholder text)", value="(placeholder text)", inline=True)
embed.add_field(name="way too much placeholder", value="some more placeholder", inline=True)
embed.add_field(name="more placeholder", value="placeholder", inline=False)
await ctx.send(embed=embed)
我什至使用了所有可能的网站,甚至是最新的网站,但我找不到任何方法来修复错误,我不断收到语法错误,但无论如何我都找不到修复它,
初始化嵌入时语法错误
embed = discord.Embed(..., color=#fff300())
python 中的评论以 #
开头,要修复它只需将其放在引号中
color="fff300"
注意:这行不通,您需要将其转换为基数为 16 的整数(也是 colour
而不是 color
):
colour=int("fff300", 16)
# Or as `Nurqm` suggested
colour=0xfff300
embed = discord.Embed(title="Info", description="This menu displays the info about this bot", colour=int("fff300", 16))
@client.command()
async def info(ctx):
embed = discord.Embed(title="Info", description="This menu displays the info about this bot", color=0xa3a3ff)
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
embed.add_field(name="placeholder", value="another placeholder", inline=False)
embed.add_field(name="so much placeholder", value="Bit more placeholder", inline=False)
embed.add_field(name="(placeholder text)", value="(placeholder text)", inline=True)
embed.add_field(name="way too much placeholder", value="some more placeholder", inline=True)
embed.add_field(name="more placeholder", value="placeholder", inline=False)
await ctx.send(embed=embed)
我看到的是一些缩进(间距)错误和颜色格式错误。除此之外,我几乎没有看到任何错误,它应该可以工作,如果没有,请告诉我们您正面临什么错误