0

I been working on a bot that verify users when I react on their pictures.

the bot is fully done now but I wanted that when I react on the picture, the bot send to the user a direct message saying "You have been verified"

This is the code I've been using (I been trying to learn python with 0 knowledge of coding)

@bot.event
async def on_raw_reaction_add(payload):
    if payload.channel_id == 1030905311231483904:
        guild_id = payload.guild_id
        guild = discord.utils.find(lambda g : g.id == guild_id, bot.guilds)

        if payload.emoji.name == '✅':
            role = discord.utils.get(guild.roles, name='Verified')
            role2 = discord.utils.get(guild.roles, name='Not-Verified')

        if role is not None:
            msg = await bot.get_channel(payload.channel_id).fetch_message(payload.message_id)
            member = msg.author
            if member is not None:
                await member.add_roles(role)
                await member.remove_roles(role2)
                print('done')
            else:
                print('member not found')
        else:
            print('role not found')
    else:
        pass

Thanks in advance for the help!

AimedEye
  • 33
  • 3

1 Answers1

1
channel = await member.create_dm()
await channel.send("You're verified!")

Discord.py how do I send a DM to anyone I want through a command

walker
  • 444
  • 2
  • 12