显示嵌入时出现问题

时间:2019-03-22 00:58:01

标签: python python-3.x discord discord.py-rewrite

您好,我无法正确显示嵌入。该功能是在调用命令List时,机器人将发送类别中的角色列表。但是,当命令被调用时,这就是我得到的

enter image description here

这不是我想要的结果,似乎colours:不在这里,我将在代码中演示如何尝试这样做。

 @commands.command(pass_context=True, no_pm=True, name='list', aliases=['roles', 'role'])
async def _list(self, ctx):
    """List of all available roles """
    guild = ctx.message.guild
    author = ctx.message.author
    botroom = self.bot.get_channel(555844758778544160) 
    intros = self.bot.get_channel(485381365366390796)
    colours = ['Blue', 'Yellow', 'Pink', 'Black']
    Games = ['LoL', 'WoW']

    if ctx.message.channel == intros:
        pass
    else:
        if ctx.message.channel == botroom:
            message = '\n**Colours:**\n' # Colour roles category here
            for role in colours: # if roles are colours list this under this category.
                message += '\n{} **({})**'.format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])]))
                message += ''
            for role in Games: #if roles are games list this under this category.
                message = '\n**Games:**\n' # Games roles category here
                message += '\n{} **({})**'.format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])]))
                message += ''
                embed = discord.Embed(title="Roles List", description=message.format(), colour=0x0080c0)
                embed.set_footer(text="Tip: to add a role from the list type the command !add/remove followed by the role.")
            await ctx.send(embed=embed)
        else:
            await ctx.send('You can only use this command in {}.'.format(botroom.mention))

我不确定出了什么问题,是否使用了错误的格式。帮助将不胜感激。

0 个答案:

没有答案