Keep getting an error for the reaction_remove, just copy-pasted my whole code(minus the client id) cause it might help, I have no idea what's wrong as the first half works perfectly fine.
Also, trying to add "if member is not None: await member.remove_roles(role) else: Print(error)" at the very end and itgave me errors every time I tried removing roles, just in case it helps.
import discord
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 806406876593127464:
guild_id = payload.guild_id
guild = discord.utils.find(lambda g : g.id == guild_id, client.guilds)
if payload.emoji.name == "049":
role = discord.utils.get(guild.roles, name = 'SCP-049')
elif payload.emoji.name == "0492":
role = discord.utils.get(guild.roles, name = 'SCP-049-2')
elif payload.emoji.name == "096":
role = discord.utils.get(guild.roles, name = 'SCP-096')
elif payload.emoji.name == "106":
role = discord.utils.get(guild.roles, name = 'SCP-106')
elif payload.emoji.name == "173":
role = discord.utils.get(guild.roles, name = 'SCP-173')
elif payload.emoji.name == "682":
role = discord.utils.get(guild.roles, name = 'SCP-682')
elif payload.emoji.name == "939":
role = discord.utils.get(guild.roles, name = 'SCP-939')
elif payload.emoji.name == "999":
role = discord.utils.get(guild.roles, name = 'SCP-999')
elif payload.emoji.name == "Chaos":
role = discord.utils.get(guild.roles, name = 'Chaos Insurgency')
elif payload.emoji.name == "DClass":
role = discord.utils.get(guild.roles, name = 'D-Class')
elif payload.emoji.name == "MTF":
role = discord.utils.get(guild.roles, name = 'MTF')
elif payload.emoji.name == "Scientist":
role = discord.utils.get(guild.roles, name = 'Scientist')
member = payload.member
await member.add_roles(role)
@client.event
async def on_raw_reaction_remove(payload):
message_id = payload.message_id
if message_id == 806406876593127464:
guild_id = payload.guild_id
guild = discord.utils.find(lambda g : g.id == guild_id, client.guilds)
if payload.emoji.name == "049":
role = discord.utils.get(guild.roles, name = 'SCP-049')
elif payload.emoji.name == "0492":
role = discord.utils.get(guild.roles, name = 'SCP-049-2')
elif payload.emoji.name == "096":
role = discord.utils.get(guild.roles, name = 'SCP-096')
elif payload.emoji.name == "106":
role = discord.utils.get(guild.roles, name = 'SCP-106')
elif payload.emoji.name == "173":
role = discord.utils.get(guild.roles, name = 'SCP-173')
elif payload.emoji.name == "682":
role = discord.utils.get(guild.roles, name = 'SCP-682')
elif payload.emoji.name == "939":
role = discord.utils.get(guild.roles, name = 'SCP-939')
elif payload.emoji.name == "999":
role = discord.utils.get(guild.roles, name = 'SCP-999')
elif payload.emoji.name == "Chaos":
role = discord.utils.get(guild.roles, name = 'Chaos Insurgency')
elif payload.emoji.name == "DClass":
role = discord.utils.get(guild.roles, name = 'D-Class')
elif payload.emoji.name == "MTF":
role = discord.utils.get(guild.roles, name = 'MTF')
elif payload.emoji.name == "Scientist":
role = discord.utils.get(guild.roles, name = 'Scientist')
member = payload.member
await member.remove_roles(role)
client.run()
It was able to give me a role after adding a reaction, but has not been able to remove the role after removing that reaction here