[英]Custom role command
I need help with custom_role command.我需要有关 custom_role 命令的帮助。 It should create for user role with custom name and colour.它应该为具有自定义名称和颜色的用户角色创建。
For now i have only:现在我只有:
@Bot.command()
async def custom_role(ctx):
await ctx.guild.create_role(name = "role")
emb = discord.Embed(description = "Role created!", color = 0x2ecc71)
await ctx.send(embed = emb)
You're almost there, you can pass the role name and colour as parameters and create a custom role with those specified as so:您快到了,您可以将角色名称和颜色作为参数传递,并使用指定的那些创建自定义角色:
@Bot.command()
async def custom_role(ctx, colour: str, *, name: str):
colour = discord.Color(value=int(colour, 16))
await ctx.guild.create_role(name = name, colour=colour)
emb = discord.Embed(description = "Role created!", color = 0x2ecc71)
await ctx.send(embed = emb)
Example of usage (assuming the prefix is ':'):用法示例(假设前缀是':'):
!custom_role 0xa83232 test role # Creates a role named 'test role' in the color red
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.