Merge pull request #306 from LimiO/dev-2.x

add answer_dice method
This commit is contained in:
Alex Root Junior 2020-04-24 02:05:08 +03:00 committed by GitHub
commit 234c051af7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -810,6 +810,35 @@ class Message(base.TelegramObject):
reply_to_message_id=self.message_id if reply else None,
reply_markup=reply_markup)
async def answer_dice(self, disable_notification: typing.Union[base.Boolean, None] = None,
reply_markup: typing.Union[InlineKeyboardMarkup,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ForceReply, None] = None,
reply: base.Boolean = False) -> Message:
"""
Use this method to send a dice, which will have a random value from 1 to 6.
On success, the sent Message is returned.
(Yes, we're aware of the “proper” singular of die.
But it's awkward, and we decided to help it change. One dice at a time!)
Source: https://core.telegram.org/bots/api#senddice
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
: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]`
:param reply: fill 'reply_to_message_id'
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
return await self.bot.send_dice(chat_id=self.chat.id,
disable_notification=disable_notification,
reply_to_message_id=self.message_id if reply else None,
reply_markup=reply_markup)
async def reply(self, text: base.String,
parse_mode: typing.Union[base.String, None] = None,
disable_web_page_preview: typing.Union[base.Boolean, None] = None,
@ -1352,6 +1381,35 @@ class Message(base.TelegramObject):
reply_to_message_id=self.message_id if reply else None,
reply_markup=reply_markup)
async def reply_dice(self, disable_notification: typing.Union[base.Boolean, None] = None,
reply_markup: typing.Union[InlineKeyboardMarkup,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ForceReply, None] = None,
reply: base.Boolean = True) -> Message:
"""
Use this method to send a dice, which will have a random value from 1 to 6.
On success, the sent Message is returned.
(Yes, we're aware of the “proper” singular of die.
But it's awkward, and we decided to help it change. One dice at a time!)
Source: https://core.telegram.org/bots/api#senddice
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
: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]`
:param reply: fill 'reply_to_message_id'
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
return await self.bot.send_dice(chat_id=self.chat.id,
disable_notification=disable_notification,
reply_to_message_id=self.message_id if reply else None,
reply_markup=reply_markup)
async def forward(self, chat_id: typing.Union[base.Integer, base.String],
disable_notification: typing.Union[base.Boolean, None] = None) -> Message:
"""