N
N
Nikita Mokhovikov2021-07-11 19:51:54
Python
Nikita Mokhovikov, 2021-07-11 19:51:54

How should the list be formatted so that it displays the titles without the shackles and square brackets?

In general, my Discord bot has a help command that displays a list of help by command.
Piece of code:

async def send_bot_help(self, mapping):
    embed = discord.Embed(title="Список моих доступных команд:", color=0x286EBA)
    embed.set_thumbnail(url=client.user.avatar_url)
    embed.set_footer(text=f"Powered by {client.user.display_name}",
                     icon_url=client.user.avatar_url)

    for cog in mapping:
        try:
            embed.add_field(name=f"{cog.qualified_name} - {settings['PREFIX']}help {cog.qualified_name}", value=f"{[command.name for command in mapping[cog]]}", inline=False)
        except AttributeError:
            pass

    await self.get_destination().send(embed=embed)

After execution, it displays a list:
60eb200d2cab8772060793.png
How should the list be formatted so that it displays names without arches and square brackets?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2021-07-11
@mohovoy

..., value=f"{','.join(map(lambda x:x.name,mapping[cog]))}", ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question