New parameters of sendPoll method

This commit is contained in:
Davte
2020-05-06 15:33:23 +02:00
parent 5ef449a542
commit 7a23045479
2 changed files with 21 additions and 5 deletions

View File

@@ -1025,6 +1025,7 @@ async def _load_talking_sessions(bot: Bot):
async def _father_command(bot, update):
return

View File

@@ -664,18 +664,33 @@ class TelegramBot:
parameters=locals()
)
async def sendPoll(self, chat_id, question, options,
dummy=None,
disable_notification=None,
reply_to_message_id=None,
async def sendPoll(self,
chat_id: Union[int, str],
question: str,
options: List[str],
is_anonymous: bool = True,
type_: str = 'regular',
allows_multiple_answers: bool = False,
correct_option_id: int = None,
explanation: str = None,
explanation_parse_mode: str = None,
open_period: int = None,
close_date: int = None,
is_closed: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup=None):
"""Send a native poll in a group, a supergroup or channel.
See https://core.telegram.org/bots/api#sendpoll for details.
"""
# To avoid shadowing `type`, this workaround is required
parameters = locals().copy()
parameters['type'] = parameters['type_']
del parameters['type_']
return await self.api_request(
'sendPoll',
parameters=locals()
parameters=parameters
)
async def sendChatAction(self, chat_id, action):