AIOG-T-93 added allow_sending_without_reply to send_poll shortcuts

This commit is contained in:
Oleg A 2020-11-08 14:19:13 +03:00
parent 01070029c2
commit b8a33c3b99

View file

@ -1143,6 +1143,7 @@ class Message(base.TelegramObject):
close_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None, close_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None,
is_closed: typing.Optional[base.Boolean] = None, is_closed: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None, disable_notification: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[ reply_markup: typing.Union[
InlineKeyboardMarkup, InlineKeyboardMarkup,
ReplyKeyboardMarkup, ReplyKeyboardMarkup,
@ -1153,41 +1154,71 @@ class Message(base.TelegramObject):
reply: base.Boolean = False, reply: base.Boolean = False,
) -> Message: ) -> Message:
""" """
Use this method to send a native poll. A native poll can't be sent to a private chat. Use this method to send a native poll. On success, the sent Message is
On success, the sent Message is returned. returned.
Source: https://core.telegram.org/bots/api#sendpoll Source: https://core.telegram.org/bots/api#sendpoll
:param question: Poll question, 1-255 characters :param question: Poll question, 1-255 characters
:type question: :obj:`base.String` :type question: :obj:`base.String`
:param options: List of answer options, 2-10 strings 1-100 characters each :param options: List of answer options, 2-10 strings 1-100 characters each
:type options: :obj:`typing.List[base.String]` :type options: :obj:`typing.List[base.String]`
:param is_anonymous: True, if the poll needs to be anonymous, defaults to True :param is_anonymous: True, if the poll needs to be anonymous, defaults to True
:type is_anonymous: :obj:`typing.Optional[base.Boolean]` :type is_anonymous: :obj:`typing.Optional[base.Boolean]`
:param type: Poll type, quiz or regular, defaults to regular :param type: Poll type, quiz or regular, defaults to regular
:type type: :obj:`typing.Optional[base.String]` :type type: :obj:`typing.Optional[base.String]`
:param allows_multiple_answers: True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
:param allows_multiple_answers: True, if the poll allows multiple answers,
ignored for polls in quiz mode, defaults to False
:type allows_multiple_answers: :obj:`typing.Optional[base.Boolean]` :type allows_multiple_answers: :obj:`typing.Optional[base.Boolean]`
:param correct_option_id: 0-based identifier of the correct answer option, required for polls in quiz mode
:param correct_option_id: 0-based identifier of the correct answer option,
required for polls in quiz mode
:type correct_option_id: :obj:`typing.Optional[base.Integer]` :type correct_option_id: :obj:`typing.Optional[base.Integer]`
:param explanation: Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
:param explanation: Text that is shown when a user chooses an incorrect
answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
with at most 2 line feeds after entities parsing
:type explanation: :obj:`typing.Optional[base.String]` :type explanation: :obj:`typing.Optional[base.String]`
:param explanation_parse_mode: Mode for parsing entities in the explanation. See formatting options for more details.
:param explanation_parse_mode: Mode for parsing entities in the explanation.
See formatting options for more details.
:type explanation_parse_mode: :obj:`typing.Optional[base.String]` :type explanation_parse_mode: :obj:`typing.Optional[base.String]`
:param open_period: Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
:param open_period: Amount of time in seconds the poll will be active after
creation, 5-600. Can't be used together with close_date.
:type open_period: :obj:`typing.Optional[base.Integer]` :type open_period: :obj:`typing.Optional[base.Integer]`
:param close_date: Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
:type close_date: :obj:`typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None]` :param close_date: Point in time (Unix timestamp) when the poll will be
automatically closed. Must be at least 5 and no more than 600 seconds in
the future. Can't be used together with open_period.
:type close_date: :obj:`typing.Union[base.Integer, datetime.datetime,
datetime.timedelta, None]`
:param is_closed: Pass True, if the poll needs to be immediately closed :param is_closed: Pass True, if the poll needs to be immediately closed
:type is_closed: :obj:`typing.Optional[base.Boolean]` :type is_closed: :obj:`typing.Optional[base.Boolean]`
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:param disable_notification: Sends the message silently. Users will receive
a notification with no sound.
:type disable_notification: :obj:`typing.Optional[Boolean]` :type disable_notification: :obj:`typing.Optional[Boolean]`
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard,
custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user :param allow_sending_without_reply: Pass True, if the message should be sent
even if the specified replied-to message is not found
:type allow_sending_without_reply: :obj:`typing.Optional[base.Boolean]`
:param reply_markup: Additional interface options. A JSON-serialized object
for an inline keyboard, custom reply keyboard, instructions to remove
reply keyboard or to force a reply from the user
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup, :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]` types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply,
None]`
:param reply: fill 'reply_to_message_id' :param reply: fill 'reply_to_message_id'
:type reply: :obj:`base.Boolean` :type reply: :obj:`base.Boolean`
:return: On success, the sent Message is returned :return: On success, the sent Message is returned
:rtype: :obj:`types.Message` :rtype: :obj:`types.Message`
""" """
@ -1206,6 +1237,7 @@ class Message(base.TelegramObject):
is_closed=is_closed, is_closed=is_closed,
disable_notification=disable_notification, disable_notification=disable_notification,
reply_to_message_id=self.message_id if reply else None, reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup, reply_markup=reply_markup,
) )
@ -2049,6 +2081,7 @@ class Message(base.TelegramObject):
close_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None, close_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None,
is_closed: typing.Optional[base.Boolean] = None, is_closed: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None, disable_notification: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[ reply_markup: typing.Union[
InlineKeyboardMarkup, InlineKeyboardMarkup,
ReplyKeyboardMarkup, ReplyKeyboardMarkup,
@ -2059,41 +2092,71 @@ class Message(base.TelegramObject):
reply: base.Boolean = True, reply: base.Boolean = True,
) -> Message: ) -> Message:
""" """
Use this method to send a native poll. A native poll can't be sent to a private chat. Use this method to send a native poll. On success, the sent Message is
On success, the sent Message is returned. returned.
Source: https://core.telegram.org/bots/api#sendpoll Source: https://core.telegram.org/bots/api#sendpoll
:param question: Poll question, 1-255 characters :param question: Poll question, 1-255 characters
:type question: :obj:`base.String` :type question: :obj:`base.String`
:param options: List of answer options, 2-10 strings 1-100 characters each :param options: List of answer options, 2-10 strings 1-100 characters each
:type options: :obj:`typing.List[base.String]` :type options: :obj:`typing.List[base.String]`
:param is_anonymous: True, if the poll needs to be anonymous, defaults to True :param is_anonymous: True, if the poll needs to be anonymous, defaults to True
:type is_anonymous: :obj:`typing.Optional[base.Boolean]` :type is_anonymous: :obj:`typing.Optional[base.Boolean]`
:param type: Poll type, quiz or regular, defaults to regular :param type: Poll type, quiz or regular, defaults to regular
:type type: :obj:`typing.Optional[base.String]` :type type: :obj:`typing.Optional[base.String]`
:param allows_multiple_answers: True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
:param allows_multiple_answers: True, if the poll allows multiple answers,
ignored for polls in quiz mode, defaults to False
:type allows_multiple_answers: :obj:`typing.Optional[base.Boolean]` :type allows_multiple_answers: :obj:`typing.Optional[base.Boolean]`
:param correct_option_id: 0-based identifier of the correct answer option, required for polls in quiz mode
:param correct_option_id: 0-based identifier of the correct answer option,
required for polls in quiz mode
:type correct_option_id: :obj:`typing.Optional[base.Integer]` :type correct_option_id: :obj:`typing.Optional[base.Integer]`
:param explanation: Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
:param explanation: Text that is shown when a user chooses an incorrect
answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
with at most 2 line feeds after entities parsing
:type explanation: :obj:`typing.Optional[base.String]` :type explanation: :obj:`typing.Optional[base.String]`
:param explanation_parse_mode: Mode for parsing entities in the explanation. See formatting options for more details.
:param explanation_parse_mode: Mode for parsing entities in the explanation.
See formatting options for more details.
:type explanation_parse_mode: :obj:`typing.Optional[base.String]` :type explanation_parse_mode: :obj:`typing.Optional[base.String]`
:param open_period: Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
:param open_period: Amount of time in seconds the poll will be active after
creation, 5-600. Can't be used together with close_date.
:type open_period: :obj:`typing.Optional[base.Integer]` :type open_period: :obj:`typing.Optional[base.Integer]`
:param close_date: Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
:type close_date: :obj:`typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None]` :param close_date: Point in time (Unix timestamp) when the poll will be
automatically closed. Must be at least 5 and no more than 600 seconds in
the future. Can't be used together with open_period.
:type close_date: :obj:`typing.Union[base.Integer, datetime.datetime,
datetime.timedelta, None]`
:param is_closed: Pass True, if the poll needs to be immediately closed :param is_closed: Pass True, if the poll needs to be immediately closed
:type is_closed: :obj:`typing.Optional[base.Boolean]` :type is_closed: :obj:`typing.Optional[base.Boolean]`
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:param disable_notification: Sends the message silently. Users will receive
a notification with no sound.
:type disable_notification: :obj:`typing.Optional[Boolean]` :type disable_notification: :obj:`typing.Optional[Boolean]`
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard,
custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user :param allow_sending_without_reply: Pass True, if the message should be sent
even if the specified replied-to message is not found
:type allow_sending_without_reply: :obj:`typing.Optional[base.Boolean]`
:param reply_markup: Additional interface options. A JSON-serialized object
for an inline keyboard, custom reply keyboard, instructions to remove
reply keyboard or to force a reply from the user
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup, :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]` types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply,
None]`
:param reply: fill 'reply_to_message_id' :param reply: fill 'reply_to_message_id'
:type reply: :obj:`base.Boolean` :type reply: :obj:`base.Boolean`
:return: On success, the sent Message is returned :return: On success, the sent Message is returned
:rtype: :obj:`types.Message` :rtype: :obj:`types.Message`
""" """
@ -2112,6 +2175,7 @@ class Message(base.TelegramObject):
is_closed=is_closed, is_closed=is_closed,
disable_notification=disable_notification, disable_notification=disable_notification,
reply_to_message_id=self.message_id if reply else None, reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup, reply_markup=reply_markup,
) )