I'm new to discord.py and I tried to send a private message with my bot when I react with the 'bro_emoji' to a specific message :
@bot.event
async def on_raw_reaction_add(payload):
emoji = payload.emoji.name
canal = payload.channel_id
message = payload.message_id
roles = bot.get_guild(payload.guild_id).roles
bro_role = get(roles, name="Bro")
member = bot.get_guild(payload.guild_id).get_member(payload.user_id)
if emoji == "bro_emoji" and canal == 920004461575954472 and message == 920004958923939901:
print('Role acquired')
await member.add_roles(bro_role) # Issue here
await member.send("Bro role acquired") # Issue here
There are the errors :
AttributeError: 'NoneType' object has no attribute 'add_roles'
AttributeError: 'NoneType' object has no attribute 'send'
Thanks :D <3