From 2ff880bb5f9894828044403a65307b8a5b7f7e05 Mon Sep 17 00:00:00 2001 From: LimiO Date: Sat, 18 Apr 2020 16:09:45 +0300 Subject: [PATCH 1/3] add answer_dice method --- aiogram/types/message.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index d50eaf28..ca46c1ef 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -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, From a7a06b730180ac50f45f53fc96db38827142e1d8 Mon Sep 17 00:00:00 2001 From: LimiO Date: Sat, 18 Apr 2020 17:40:26 +0300 Subject: [PATCH 2/3] Add reply_dice method --- aiogram/types/message.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index ca46c1ef..33b9d8ad 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -1381,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 = 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 forward(self, chat_id: typing.Union[base.Integer, base.String], disable_notification: typing.Union[base.Boolean, None] = None) -> Message: """ From e50f9e5269c4d628606b7425f933e90f8beadd46 Mon Sep 17 00:00:00 2001 From: LimiO Date: Sat, 18 Apr 2020 17:47:03 +0300 Subject: [PATCH 3/3] Change False to True at reply_dice --- aiogram/types/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index 33b9d8ad..4dd853ac 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -1386,7 +1386,7 @@ class Message(base.TelegramObject): ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply, None] = None, - reply: base.Boolean = False) -> Message: + 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.