Skip to content

Commit

Permalink
Remove unnecessary warning logs for poll events
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapptz committed Jun 14, 2024
1 parent 837bc35 commit fb12d3d
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions discord/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,13 +1648,8 @@ def parse_message_poll_vote_add(self, data: gw.PollVoteActionEvent) -> None:

if message and user:
poll = self._update_poll_counts(message, raw.answer_id, True, raw.user_id == self.self_id)
if not poll:
_log.warning(
'POLL_VOTE_ADD referencing message with ID: %s does not have a poll. Discarding.', raw.message_id
)
return

self.dispatch('poll_vote_add', user, poll.get_answer(raw.answer_id))
if poll:
self.dispatch('poll_vote_add', user, poll.get_answer(raw.answer_id))

def parse_message_poll_vote_remove(self, data: gw.PollVoteActionEvent) -> None:
raw = RawPollVoteActionEvent(data)
Expand All @@ -1671,13 +1666,8 @@ def parse_message_poll_vote_remove(self, data: gw.PollVoteActionEvent) -> None:

if message and user:
poll = self._update_poll_counts(message, raw.answer_id, False, raw.user_id == self.self_id)
if not poll:
_log.warning(
'POLL_VOTE_REMOVE referencing message with ID: %s does not have a poll. Discarding.', raw.message_id
)
return

self.dispatch('poll_vote_remove', user, poll.get_answer(raw.answer_id))
if poll:
self.dispatch('poll_vote_remove', user, poll.get_answer(raw.answer_id))

def _get_reaction_user(self, channel: MessageableChannel, user_id: int) -> Optional[Union[User, Member]]:
if isinstance(channel, (TextChannel, Thread, VoiceChannel)):
Expand Down

0 comments on commit fb12d3d

Please sign in to comment.