fix fetching role

This commit is contained in:
Mylloon 2021-09-02 03:44:47 +02:00
parent 65e0e25e32
commit 56f5d23e20

View file

@ -127,7 +127,7 @@ class ConfrerieDuKassoulait(commands.Cog):
self.emoji_to_role[payload.emoji.id] self.emoji_to_role[payload.emoji.id]
except KeyError: except KeyError:
return return
await payload.member.add_roles(self.client.get_role(self.emoji_to_role[payload.emoji.id])) await payload.member.add_roles(payload.member.guild.get_role(self.emoji_to_role[payload.emoji.id]))
@commands.Cog.listener() @commands.Cog.listener()
async def on_raw_reaction_remove(self, payload): async def on_raw_reaction_remove(self, payload):
@ -139,4 +139,4 @@ class ConfrerieDuKassoulait(commands.Cog):
return return
guild = discord.utils.find(lambda g: g.id == payload.guild_id, self.client.guilds) 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) member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
await member.remove_roles(self.client.get_role(self.emoji_to_role[payload.emoji.id])) await member.remove_roles(guild.get_role(self.emoji_to_role[payload.emoji.id]))