Skip to content

Commit e36b464

Browse files
Added added_by_user, addition_date, and added_by_chat to PollOption
1 parent 288e18c commit e36b464

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

telebot/types.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7431,11 +7431,20 @@ class PollOption(JsonDeserializable):
74317431
:param text: Option text, 1-100 characters
74327432
:type text: :obj:`str`
74337433

7434+
:param text_entities: Optional. Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts
7435+
:type text_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
7436+
74347437
:param voter_count: Number of users that voted for this option
74357438
:type voter_count: :obj:`int`
74367439

7437-
:param text_entities: Optional. Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts
7438-
:type text_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
7440+
:param added_by_user: Optional. User who added the option; omitted if the option wasn't added by a user after poll creation
7441+
:type added_by_user: :class:`telebot.types.User`
7442+
7443+
:param added_by_chat: Optional. Chat that added the option; omitted if the option wasn't added by a chat after poll creation
7444+
:type added_by_chat: :class:`telebot.types.Chat`
7445+
7446+
:param addition_date: Optional. Point in time (Unix timestamp) when the option was added; omitted if the option existed in the original poll
7447+
:type addition_date: :obj:`int`
74397448

74407449
:return: Instance of the class
74417450
:rtype: :class:`telebot.types.PollOption`
@@ -7446,13 +7455,20 @@ def de_json(cls, json_string):
74467455
obj = cls.check_json(json_string, dict_copy=False)
74477456
if 'text_entities' in obj:
74487457
obj['text_entities'] = Message.parse_entities(obj['text_entities'])
7458+
if 'added_by_user' in obj:
7459+
obj['added_by_user'] = User.de_json(obj['added_by_user'])
7460+
if 'added_by_chat' in obj:
7461+
obj['added_by_chat'] = Chat.de_json(obj['added_by_chat'])
74497462
return cls(**obj)
74507463

7451-
def __init__(self, text, persistent_id, voter_count = 0, text_entities=None, **kwargs):
7464+
def __init__(self, text, persistent_id, voter_count = 0, text_entities=None, added_by_user=None, added_by_chat=None, addition_date=None, **kwargs):
74527465
self.text: str = text
74537466
self.persistent_id: str = persistent_id
74547467
self.voter_count: int = voter_count
74557468
self.text_entities: Optional[List[MessageEntity]] = text_entities
7469+
self.added_by_user: Optional[User] = added_by_user
7470+
self.added_by_chat: Optional[Chat] = added_by_chat
7471+
self.addition_date: Optional[int] = addition_date
74567472
# Converted in _convert_poll_options
74577473
# def to_json(self):
74587474
# # send_poll Option is a simple string: https://core.telegram.org/bots/api#sendpoll

0 commit comments

Comments
 (0)