Browse Source

Fix Message.poll not prioritising API data over cached data

pull/10109/head
Rapptz 11 months ago
committed by dolfies
parent
commit
f45016bebd
  1. 11
      discord/message.py

11
discord/message.py

@ -1688,12 +1688,11 @@ class Message(PartialMessage, Hashable):
# This updates the poll so it has the counts, if the message # This updates the poll so it has the counts, if the message
# was previously cached. # was previously cached.
self.poll: Optional[Poll] = state._get_poll(self.id) self.poll: Optional[Poll] = None
if self.poll is None: try:
try: self.poll = Poll._from_data(data=data['poll'], message=self, state=state)
self.poll = Poll._from_data(data=data['poll'], message=self, state=state) except KeyError:
except KeyError: self.poll = state._get_poll(self.id)
pass
try: try:
# If the channel doesn't have a guild attribute, we handle that # If the channel doesn't have a guild attribute, we handle that

Loading…
Cancel
Save