Answer the question
In order to leave comments, you need to log in
How to make a command for issuing roles?
Help. I want to make a command to issue roles on discord.py. Here's how it should be done: ?grant @mention user @mention role. For example ?grant @Fox#1632 @ Moderator. Can you give me a code.
Answer the question
In order to leave comments, you need to log in
@client.command()
async def news(ctx, member: discord.Member = None):
if member is None:
role = ctx.guild.get_role(
ID роли которую хочешь выдать
)
await ctx.author.add_roles(role)
await ctx.send(
embed=discord.Embed(
description=f"**Вы взяли себе роль {role.mention}**",
color=discord.Color.purple(),
)
)
else:
role = ctx.guild.get_role(
ID роли которую хочешь выдать
)
await ctx.author.add_roles(role)
await ctx.send(
embed=discord.Embed(
description=f"Вы выдали **{ctx.author}** роль {role.mention}",
color=discord.Color.purple(),
)
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question