AIOG-T-90 Poll docs update

This commit is contained in:
Oleg A 2020-11-05 23:23:00 +03:00
parent 6e9b07a540
commit c39ebcf7de

View file

@ -1104,7 +1104,8 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
result = await self.request(api.Methods.SEND_CONTACT, payload)
return types.Message(**result)
async def send_poll(self, chat_id: typing.Union[base.Integer, base.String],
async def send_poll(self,
chat_id: typing.Union[base.Integer, base.String],
question: base.String,
options: typing.List[base.String],
is_anonymous: typing.Optional[base.Boolean] = None,
@ -1115,54 +1116,85 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
explanation_parse_mode: typing.Optional[base.String] = None,
open_period: typing.Union[base.Integer, None] = None,
close_date: typing.Union[
base.Integer, datetime.datetime, datetime.timedelta, None] = None,
base.Integer,
datetime.datetime,
datetime.timedelta,
None] = None,
is_closed: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove,
types.ForceReply, None] = None) -> types.Message:
types.ForceReply, None] = None,
) -> types.Message:
"""
Use this method to send a native poll. A native poll can't be sent to a private chat.
On success, the sent Message is returned.
Use this method to send a native poll. On success, the sent Message is
returned.
Source: https://core.telegram.org/bots/api#sendpoll
:param chat_id: Unique identifier for the target chat
or username of the target channel (in the format @channelusername).
A native poll can't be sent to a private chat.
:param chat_id: Unique identifier for the target chat or username of the
target channel (in the format @channelusername)
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
:param question: Poll question, 1-255 characters
:param question: Poll question, 1-300 characters
:type question: :obj:`base.String`
:param options: List of answer options, 2-10 strings 1-100 characters each
:param options: A list of answer options, 2-10 strings 1-100 characters each
:type options: :obj:`typing.List[base.String]`
:param is_anonymous: True, if the poll needs to be anonymous, defaults to True
:type is_anonymous: :obj:`typing.Optional[base.Boolean]`
:param type: Poll type, quiz or regular, defaults to regular
: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]`
: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]`
: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]`
: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]`
: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.Union[base.Integer, 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 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
: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]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:param reply_to_message_id: If the message is a reply, ID of the original
message
:type reply_to_message_id: :obj:`typing.Optional[Integer]`
: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 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,
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]`
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply,
None]`
:return: On success, the sent Message is returned
:rtype: :obj:`types.Message`
"""