Skip to content

Commit

Permalink
Added the field voter_chat to the class PollAnswer, to contain channe…
Browse files Browse the repository at this point in the history
…l chat voters in Polls.
  • Loading branch information
coder2020official committed Aug 18, 2023
1 parent b5112d8 commit 35e765f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion telebot/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6695,6 +6695,9 @@ class PollAnswer(JsonSerializable, JsonDeserializable, Dictionaryable):
:param poll_id: Unique poll identifier
:type poll_id: :obj:`str`
:param voter_chat: Optional. The chat that changed the answer to the poll, if the voter is anonymous
:type voter_chat: :class:`telebot.types.Chat`
:param user: The user, who changed the answer to the poll
:type user: :class:`telebot.types.User`
Expand All @@ -6710,12 +6713,16 @@ def de_json(cls, json_string):
if (json_string is None): return None
obj = cls.check_json(json_string)
obj['user'] = User.de_json(obj['user'])
if 'voter_chat' in obj:
obj['voter_chat'] = Chat.de_json(obj['voter_chat'])
return cls(**obj)

def __init__(self, poll_id, user, option_ids, **kwargs):
def __init__(self, poll_id, user, option_ids, voter_chat=None, **kwargs):
self.poll_id: str = poll_id
self.user: User = user
self.option_ids: List[int] = option_ids
self.voter_chat: Optional[Chat] = voter_chat


def to_json(self):
return json.dumps(self.to_dict())
Expand Down

0 comments on commit 35e765f

Please sign in to comment.