Answers for "reaction role discord.py"

1

add role discord .py

member = message.author
var = discord.utils.get(message.guild.roles, name = "role name")
member.add_role(var)
Posted by: Guest on February-29-2020
7

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')
Posted by: Guest on September-29-2020
0

reaction role discord.py

@client.command('role')
@commands.has_permissions(administrator=True) #permissions
async def role(ctx, user : discord.Member, *, role : discord.Role):
  if role.position > ctx.author.top_role.position: #if the role is above users top role it sends error
    return await ctx.send('**:x: | That role is above your top role!**') 
  if role in user.roles:
      await user.remove_roles(role) #removes the role if user already has
      await ctx.send(f"Removed {role} from {user.mention}")
  else:
      await user.add_roles(role) #adds role if not already has it
      await ctx.send(f"Added {role} to {user.mention}")
Posted by: Guest on November-23-2021
0

reaction role discord.py

roleVer = 'BOT' #role to add
user = ctx.message.author #user
role = roleVer # change the name from roleVer to role

await ctx.send("""Attempting to Verify {}""".format(user))
try:
    await user.add_roles(discord.utils.get(user.guild.roles, name=role)) #add the role
except Exception as e:
    await ctx.send('There was an error running this command ' + str(e)) #if error
else:
    await ctx.send("""Verified: {}""".format(user)) # no errors, say verified
Posted by: Guest on November-23-2021
0

reaction role discord.py

@role.error
async def role_error(ctx, error):
  if isinstance(error, MissingPermissions):
    await ctx.send('**:x: | You do not have permission to use this command!**')
Posted by: Guest on November-23-2021
0

reaction role discord.py

@bot.command(pass_context=True)
async def giverole(ctx, user: discord.Member, role: discord.Role):
    await user.add_roles(role)
    await ctx.send(f"hey {ctx.author.name}, {user.name} has been giving a role called: {role.name}")
Posted by: Guest on November-23-2021

Code answers related to "reaction role discord.py"

Python Answers by Framework

Browse Popular Code Answers by Language