From d619b0fe17948457ef617b635d84281d63ac5b4d Mon Sep 17 00:00:00 2001 From: Conatum Date: Sun, 24 Oct 2021 19:39:06 +0300 Subject: [PATCH] fix (rroles): Fix tracker issues. Make `cancel_expiry` arguments consistent with call. Add initial `guild` ward to the raw reaction events. --- bot/modules/guild_admin/reaction_roles/expiry.py | 2 +- bot/modules/guild_admin/reaction_roles/tracker.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/modules/guild_admin/reaction_roles/expiry.py b/bot/modules/guild_admin/reaction_roles/expiry.py index 2624c49d..f928cd74 100644 --- a/bot/modules/guild_admin/reaction_roles/expiry.py +++ b/bot/modules/guild_admin/reaction_roles/expiry.py @@ -40,7 +40,7 @@ def schedule_expiry(guildid, userid, roleid, expiry, reactionid=None): _wakeup_event.set() -def cancel_expiry(key): +def cancel_expiry(*key): """ Cancel expiry for the given member and role, if it exists. """ diff --git a/bot/modules/guild_admin/reaction_roles/tracker.py b/bot/modules/guild_admin/reaction_roles/tracker.py index baf232ba..6d130263 100644 --- a/bot/modules/guild_admin/reaction_roles/tracker.py +++ b/bot/modules/guild_admin/reaction_roles/tracker.py @@ -546,7 +546,7 @@ class ReactionRoleMessage: @client.add_after_event('raw_reaction_add') async def reaction_role_add(client, payload): reaction_message = ReactionRoleMessage.fetch(payload.message_id) - if not payload.member.bot and reaction_message and reaction_message.enabled: + if payload.guild_id and not payload.member.bot and reaction_message and reaction_message.enabled: try: await reaction_message.process_raw_reaction_add(payload) except Exception: @@ -564,7 +564,7 @@ async def reaction_role_add(client, payload): @client.add_after_event('raw_reaction_remove') async def reaction_role_remove(client, payload): reaction_message = ReactionRoleMessage.fetch(payload.message_id) - if reaction_message and reaction_message.enabled: + if payload.guild_id and reaction_message and reaction_message.enabled: try: await reaction_message.process_raw_reaction_remove(payload) except Exception: