Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord bot sending direct message after verifying

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)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

@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!

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading