79650671

Date: 2025-06-03 05:41:44
Score: 0.5
Natty:
Report link

For this you will require

This can be accomplished using the code :

@bot.command()
async def remove_roles(ctx, member: discord.Member):
    #get guild and role of 1st guild
    guild1 = client.get_guild(<ID>) # ID of 1st guild
    role1 = guild1.get_role(<Role ID>) # ID of the role of 1st guild
    #get guild and role of 2nd guild
    guild2 = client.get_guild(<ID>) # ID of 2nd guild
    role2 = guild2.get_role(<Role ID>) # ID of the role of 2nd guild
    
    #remove role from user in 1st guild
    m1 = guild1.get_member(member.id)
    await m1.remove_roles(role1)
    
    #remove role from user in 2nd guild
    m2 = guild2.get_member(member.id)
    await m2.remove_roles(role2)
    
    await ctx.send("Roles are removed from the user.")

This is a minimal reproducible example and you can further change it according to your needs.


Reference:

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Arjit Gupta