Skip to content

Commit

Permalink
Merge pull request #83 from murpii/pr-fix-error-state-shenanigans
Browse files Browse the repository at this point in the history
MT: Use message.reactions instead of checking the raw payload data
  • Loading branch information
def- authored Feb 21, 2024
2 parents 16c12f3 + bfdf0f4 commit 36cbc3b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cogs/map_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,12 @@ async def handle_submission_edit(self, payload: discord.RawMessageUpdateEvent):
if not ('attachments' in data and data['attachments'] and data['attachments'][0]['filename'].endswith('.map')):
return

# don't handle already processed submissions
if 'reactions' in data and data['reactions'][0]['emoji']['name'] == str(SubmissionState.PROCESSED):
return

channel = self.bot.get_channel(payload.channel_id)
message = self.bot.get_message(payload.message_id) or await channel.fetch_message(payload.message_id)

if any(str(SubmissionState.PROCESSED) == reaction.emoji for reaction in message.reactions):
return

isubm = InitialSubmission(message)
await self.validate_submission(isubm)

Expand Down

0 comments on commit 36cbc3b

Please sign in to comment.