服务器角色命令 Discord.py
Server roles command Discord.py
所以最近我试图在我的 discord 机器人中创建服务器角色命令,它将显示服务器中存在的所有角色。我想将它们设置在单列而不是行中。我做不到。我可以做哪些更改以在单个专栏中显示它[抱歉,如果我不能让您正确理解,因为我的英语有点差。]任何帮助表示赞赏!
我想要的样子:
情况如何:
我的当前代码:
@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)
如果 HTML 转义描述被禁用,则将连接字符串更改为 description=f"<br>".join([role.mention for role in roles])
会起作用。
您需要在提及角色后添加\n
。这将在嵌入中开始一个新行。
所以最近我试图在我的 discord 机器人中创建服务器角色命令,它将显示服务器中存在的所有角色。我想将它们设置在单列而不是行中。我做不到。我可以做哪些更改以在单个专栏中显示它[抱歉,如果我不能让您正确理解,因为我的英语有点差。]任何帮助表示赞赏!
我想要的样子:
情况如何:
我的当前代码:
@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)
如果 HTML 转义描述被禁用,则将连接字符串更改为 description=f"<br>".join([role.mention for role in roles])
会起作用。
您需要在提及角色后添加\n
。这将在嵌入中开始一个新行。