Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

python - Server roles command Discord.py

So recently i was trying to make server roles command in my discord bot, that will display all the roles present in server. I wanted to set them in a single column and not in rows. I wasn't able to do so. What changes can i make to show it in a single column [sorry if i wasnt able to make u understand correctly as i m a bit poor in english.] Any help is appreciated!

How I Want It To Be:

How I Want It To Be

How It Is:

enter image description here

My Current Code:

@commands.command(pass_context=True)
    async def roles(self, ctx):
        guild = ctx.guild
        roles = [role for role in guild.roles if role != ctx.guild.default_role]
        embed = discord.Embed(title="Server Roles", description=f" ".join([role.mention for role in roles]))
        await ctx.send(embed=embed)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to add after you mention the role. This will start a new line in the embed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...