add role discord .py
member = message.author
var = discord.utils.get(message.guild.roles, name = "role name")
member.add_role(var)
add role discord .py
member = message.author
var = discord.utils.get(message.guild.roles, name = "role name")
member.add_role(var)
adding roles discord py
# If you need this in a bot command
@bot.command()
async def online(ctx):
role = discord.utils.get(bot.get_guild(ctx.guild.id).roles, id ="Role ID")
await member.add_roles(role)
create a role with discord.py
@client.command(aliases=['make_role'])
@commands.has_permissions(manage_roles=True) # Check if the user executing the command can manage roles
async def create_role(ctx, *, name):
guild = ctx.guild
await guild.create_role(name=name)
await ctx.send(f'Role `{name}` has been created')
How to create role discord.py
guild = ctx.guild
await guild.create_role(name="role name")
adding roles discord py
# If you need this in a bot command
@discord.ext.commands.command()
async def online(ctx):
role = discord.utils.get(bot.get_guild(ctx.guild.id).roles, id ="Role ID")
await member.add_roles(role)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us