0
votes

So, I'm making a bot for a server I'm in, and when you join it gives you an Unverified role. The owner has set up a verify reaction with Carl-Bot, and I'm wondering how I can make my bot remove the unverified role when the user verifies?

My code:

@client.event
async def on_member_join(member):
    try:
        role = discord.utils.get(member.guild.roles, name="Unverified")
        await member.add_roles(role)
        print(f"{member} has joined")
        verify = member.guild.get_channel(772263419210235916)
        rules =  member.guild.get_channel(772995392521895937)
        channel = client.get_channel(772583213797212211)
        embed=discord.Embed(title="Welcome to Delight Stuidos!",
                            description=f"{member.mention} has joined! \nDon't forget to read the {rules.mention}, and react with the purple star in {verify.mention}!\n Enjoy your stay ^^",
                            color = discord.Colour.orange())
        embed.set_thumbnail(
            url=member.avatar_url
        )
        await channel.send(embed=embed)
        e = discord.Embed(title="Welcome to DS!",
                          description=f"""Be sure read the {rules.mention}\nand to verify with the purple heart in {verify.mention}!
                          If you have any questions, feel free to DM the mods and/or owner of the server!""",
                          color=discord.Colour.orange())
        await member.send(embed=e)
    except Exception as e:
        print(e)

Thanks!

1

1 Answers

0
votes

A simple way could instead be a using verify, it gives the author the role and removes the unverified role


@client.command()
async def verify(ctx):
        member = ctx.author
        role_remove = discord.utils.get(member.guild.roles, name="Unverified")
        await member.remove_roles(role_remove)

        role_add = discord.utils.get(member.guild.roles, name="Verified")
        await member.add_roles(role_add)
        await ctx.send(f'Thanks, {member} for verification! You will now have access to the rest of our server.', delete_after=3)