From 65e0e25e327f2bfd54aa6d974397f36fad570fe8 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 2 Sep 2021 03:33:45 +0200 Subject: [PATCH] use role id instead of role names --- src/cogs/confreriedukassoulait.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/cogs/confreriedukassoulait.py b/src/cogs/confreriedukassoulait.py index d3195ca..75d521a 100644 --- a/src/cogs/confreriedukassoulait.py +++ b/src/cogs/confreriedukassoulait.py @@ -16,11 +16,11 @@ class ConfrerieDuKassoulait(commands.Cog): self.client = client self.role_message_id = 882785207235788800 # ID of the message that can be reacted to to add/remove a role. self.emoji_to_role = { - 882783004706095194: "L1", # elephant - 882783004697714789: "L2", # gorilla - 882783004416675881: "L3", # cat - 882783005108744202: "visiteurs ✨", # rabbit - 882783004911624212: "Alumni" # dog + 882783004706095194: 882616261626970112, # elephant - l1 + 882783004697714789: 882616188830629998, # gorilla - l2 + 882783004416675881: 882616082022670387, # cat - - l3 + 882783005108744202: 882616475918147654, # rabbit - visiteurs + 882783004911624212: 882616714133635093 # dog - alumni } @commands.Cog.listener() @@ -127,8 +127,7 @@ class ConfrerieDuKassoulait(commands.Cog): self.emoji_to_role[payload.emoji.id] except KeyError: return - role = discord.utils.get(payload.member.guild.roles, name = self.emoji_to_role[payload.emoji.id]) - await payload.member.add_roles(role) + await payload.member.add_roles(self.client.get_role(self.emoji_to_role[payload.emoji.id])) @commands.Cog.listener() async def on_raw_reaction_remove(self, payload): @@ -140,5 +139,4 @@ class ConfrerieDuKassoulait(commands.Cog): return guild = discord.utils.find(lambda g: g.id == payload.guild_id, self.client.guilds) member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members) - role = discord.utils.get(guild.roles, name = self.emoji_to_role[payload.emoji.id]) - await member.remove_roles(role) + await member.remove_roles(self.client.get_role(self.emoji_to_role[payload.emoji.id]))