为什么我的嵌入看起来像 Discord.py 上的代码?
Why do my embeds look like code on Discord.py?
我试图为我正在处理的机器人制作一个帮助嵌入页面。然而,它没有嵌入,而是显示了这个乱码:
我使用的代码:
@client.command
async def help(ctx):
print("ctx.message.author.avatar_url")
embed=discord.Embed(title="Commands", description="Help Page", color=0xad1f1f)
embed.set_author(name=ctx.message.author.name + "#" + ctx.message.author.discriminator, icon_url=ctx.message.author.avatar_url)
embed.add_field(name=".help", value="Shows this page. Do .help [Page] for more help pages", inline=False)
embed.add_field(name=".say", value="Says what you input and removes your message. (Administrator Exclusive)", inline=False)
embed.add_field(name=".avatar", value="Sends your avatar. Or the avatar of anyone mentioned or replied to.", inline=False)
embed.set_footer(text="Page (1/1)")
await ctx.message.reply(embed=embed)
我什么都试过了。我用谷歌搜索,打印所有变量,以防 avatar_url
出现问题。而我现在只是厌倦了它。也许这是一个语法错误,我真的很愚蠢,我希望不是这样。
这是来自 discord.py 的默认帮助命令。通过在定义您的机器人后立即添加来禁用它:
例如:
client = commands.Bot(command_prefix="$", case_insensitive=True)
client.remove_command('help')
您还可以删除默认的帮助命令,方法是:
bot = commands.Bot(command_prefix='!', help_command=None)
我试图为我正在处理的机器人制作一个帮助嵌入页面。然而,它没有嵌入,而是显示了这个乱码:
我使用的代码:
@client.command
async def help(ctx):
print("ctx.message.author.avatar_url")
embed=discord.Embed(title="Commands", description="Help Page", color=0xad1f1f)
embed.set_author(name=ctx.message.author.name + "#" + ctx.message.author.discriminator, icon_url=ctx.message.author.avatar_url)
embed.add_field(name=".help", value="Shows this page. Do .help [Page] for more help pages", inline=False)
embed.add_field(name=".say", value="Says what you input and removes your message. (Administrator Exclusive)", inline=False)
embed.add_field(name=".avatar", value="Sends your avatar. Or the avatar of anyone mentioned or replied to.", inline=False)
embed.set_footer(text="Page (1/1)")
await ctx.message.reply(embed=embed)
我什么都试过了。我用谷歌搜索,打印所有变量,以防 avatar_url
出现问题。而我现在只是厌倦了它。也许这是一个语法错误,我真的很愚蠢,我希望不是这样。
这是来自 discord.py 的默认帮助命令。通过在定义您的机器人后立即添加来禁用它:
例如:
client = commands.Bot(command_prefix="$", case_insensitive=True)
client.remove_command('help')
您还可以删除默认的帮助命令,方法是:
bot = commands.Bot(command_prefix='!', help_command=None)