fix (rroles): Fix tracker issues.
Make `cancel_expiry` arguments consistent with call. Add initial `guild` ward to the raw reaction events.
This commit is contained in:
@@ -40,7 +40,7 @@ def schedule_expiry(guildid, userid, roleid, expiry, reactionid=None):
|
|||||||
_wakeup_event.set()
|
_wakeup_event.set()
|
||||||
|
|
||||||
|
|
||||||
def cancel_expiry(key):
|
def cancel_expiry(*key):
|
||||||
"""
|
"""
|
||||||
Cancel expiry for the given member and role, if it exists.
|
Cancel expiry for the given member and role, if it exists.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ class ReactionRoleMessage:
|
|||||||
@client.add_after_event('raw_reaction_add')
|
@client.add_after_event('raw_reaction_add')
|
||||||
async def reaction_role_add(client, payload):
|
async def reaction_role_add(client, payload):
|
||||||
reaction_message = ReactionRoleMessage.fetch(payload.message_id)
|
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:
|
try:
|
||||||
await reaction_message.process_raw_reaction_add(payload)
|
await reaction_message.process_raw_reaction_add(payload)
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -564,7 +564,7 @@ async def reaction_role_add(client, payload):
|
|||||||
@client.add_after_event('raw_reaction_remove')
|
@client.add_after_event('raw_reaction_remove')
|
||||||
async def reaction_role_remove(client, payload):
|
async def reaction_role_remove(client, payload):
|
||||||
reaction_message = ReactionRoleMessage.fetch(payload.message_id)
|
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:
|
try:
|
||||||
await reaction_message.process_raw_reaction_remove(payload)
|
await reaction_message.process_raw_reaction_remove(payload)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user