From 43a210e21f9faa64f0915135582c84be708630bf Mon Sep 17 00:00:00 2001 From: Oleg A Date: Tue, 7 Apr 2020 12:55:24 +0300 Subject: [PATCH 01/15] Updated telegram version shield --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6af84f0b..a4c5b5fc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![PyPi status](https://img.shields.io/pypi/status/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![Downloads](https://img.shields.io/pypi/dm/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![Supported python versions](https://img.shields.io/pypi/pyversions/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) -[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.6-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) +[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.7-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) [![Documentation Status](https://img.shields.io/readthedocs/aiogram?style=flat-square)](http://docs.aiogram.dev/en/latest/?badge=latest) [![Github issues](https://img.shields.io/github/issues/aiogram/aiogram.svg?style=flat-square)](https://github.com/aiogram/aiogram/issues) [![MIT License](https://img.shields.io/pypi/l/aiogram.svg?style=flat-square)](https://opensource.org/licenses/MIT) From e4c1f4acc85c392bab99912c8dd887736b01c434 Mon Sep 17 00:00:00 2001 From: culnaen <54394508+culnaen@users.noreply.github.com> Date: Wed, 8 Apr 2020 18:30:12 +0300 Subject: [PATCH 02/15] fix --- aiogram/dispatcher/webhook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiogram/dispatcher/webhook.py b/aiogram/dispatcher/webhook.py index a717b486..ed2ebf99 100644 --- a/aiogram/dispatcher/webhook.py +++ b/aiogram/dispatcher/webhook.py @@ -182,7 +182,7 @@ class WebhookRequestHandler(web.View): try: try: await waiter - except asyncio.futures.CancelledError: + except asyncio.CancelledError: fut.remove_done_callback(cb) fut.cancel() raise From 2ff880bb5f9894828044403a65307b8a5b7f7e05 Mon Sep 17 00:00:00 2001 From: LimiO Date: Sat, 18 Apr 2020 16:09:45 +0300 Subject: [PATCH 03/15] 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 04/15] 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 05/15] 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. From 4fafba17b91b26e5aac8e5f2d8d2dfaab2e260b1 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 24 Apr 2020 20:09:36 +0200 Subject: [PATCH 06/15] Add emoji to send_dice method --- aiogram/bot/bot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 10b7ef7c..0953edc0 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -918,6 +918,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): async def send_dice(self, chat_id: typing.Union[base.Integer, base.String], disable_notification: typing.Union[base.Boolean, None] = None, + emoji: typing.Union[base.String, None] = None, reply_to_message_id: typing.Union[base.Integer, None] = None, reply_markup: typing.Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, @@ -933,6 +934,8 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :param chat_id: Unique identifier for the target chat or username of the target channel :type chat_id: :obj:`typing.Union[base.Integer, base.String]` + :param emoji: Emoji on which the dice throw animation is based. Currently, must be one of “🎲” or “🎯”. Defauts to “🎲” + :type emoji: :obj:`typing.Union[base.String, None]` :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_to_message_id: If the message is a reply, ID of the original message From cc650047dffd5c6a9f62539ed9e9203f0776007a Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 17:12:03 +0300 Subject: [PATCH 07/15] i-AIOG-12: Add explanation and explanation_parse_mode in the sendPoll --- aiogram/bot/bot.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 0953edc0..2d0e3994 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -870,6 +870,8 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): type: typing.Optional[base.String] = None, allows_multiple_answers: typing.Optional[base.Boolean] = None, correct_option_id: typing.Optional[base.Integer] = None, + explanation: typing.Optional[base.String] = None, + explanation_parse_mode: typing.Optional[base.String] = None, is_closed: typing.Optional[base.Boolean] = None, disable_notification: typing.Optional[base.Boolean] = None, reply_to_message_id: typing.Optional[base.Integer] = None, @@ -888,17 +890,21 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :param question: Poll question, 1-255 characters :type question: :obj:`base.String` :param options: List of answer options, 2-10 strings 1-100 characters each - :param 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: :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: :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: :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: :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 + :type explanation: :obj:`typing.Optional[base.String]` + :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 is_closed: Pass True, if the poll needs to be immediately closed - :param 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. :type disable_notification: :obj:`typing.Optional[Boolean]` :param reply_to_message_id: If the message is a reply, ID of the original message From b42ea0f2ceb7483fedf8d4f991203460539fdc22 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 17:22:13 +0300 Subject: [PATCH 08/15] i-AIOG-12: Add default parse mode --- aiogram/bot/bot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 2d0e3994..7b007b97 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -918,6 +918,8 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): """ options = prepare_arg(options) payload = generate_payload(**locals()) + if self.parse_mode: + payload.setdefault('explanation_parse_mode', self.parse_mode) result = await self.request(api.Methods.SEND_POLL, payload) return types.Message(**result) From 7e3f83ebfe6e92ba3a30656d741d812dbccbc340 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 17:30:44 +0300 Subject: [PATCH 09/15] i-AIOG-13: Add explanation and explanation_entities to the Poll object --- aiogram/types/poll.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/aiogram/types/poll.py b/aiogram/types/poll.py index 86b41d7e..9e1315ca 100644 --- a/aiogram/types/poll.py +++ b/aiogram/types/poll.py @@ -2,7 +2,9 @@ import typing from ..utils import helper from . import base, fields +from .message_entity import MessageEntity from .user import User +from ..utils.text_decorations import html_decoration, markdown_decoration class PollOption(base.TelegramObject): @@ -44,6 +46,31 @@ class Poll(base.TelegramObject): type: base.String = fields.Field() allows_multiple_answers: base.Boolean = fields.Field() correct_option_id: base.Integer = fields.Field() + explanation: base.String = fields.Field() + explanation_entities: base.String = fields.ListField(base=MessageEntity) + + def parse_entities(self, as_html=True): + text_decorator = html_decoration if as_html else markdown_decoration + + return text_decorator.unparse(self.explanation or '', self.explanation_entities or []) + + @property + def md_explanation(self) -> str: + """ + Explanation formatted as markdown. + + :return: str + """ + return self.parse_entities(False) + + @property + def html_explanation(self) -> str: + """ + Explanation formatted as HTML + + :return: str + """ + return self.parse_entities() class PollType(helper.Helper): From 8906609f0e44d4f805071abbc19b288e833da01e Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 17:39:35 +0300 Subject: [PATCH 10/15] i-AIOG-14: Add open_period and close_date in the method sendPoll --- aiogram/bot/bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 7b007b97..384e9221 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -872,6 +872,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): correct_option_id: typing.Optional[base.Integer] = None, explanation: typing.Optional[base.String] = None, explanation_parse_mode: typing.Optional[base.String] = None, + open_period: 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, disable_notification: typing.Optional[base.Boolean] = None, reply_to_message_id: typing.Optional[base.Integer] = None, @@ -903,6 +907,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :type explanation: :obj:`typing.Optional[base.String]` :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. + :type open_period: :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. @@ -917,6 +925,8 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :rtype: :obj:`types.Message` """ options = prepare_arg(options) + open_period = prepare_arg(open_period) + close_date = prepare_arg(close_date) payload = generate_payload(**locals()) if self.parse_mode: payload.setdefault('explanation_parse_mode', self.parse_mode) From f5e4016bf83100fa5018e84b9fdc0cf5ebb4eaf5 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 17:48:23 +0300 Subject: [PATCH 11/15] i-AIOG-15: Add open_period and close_date to the Poll object --- aiogram/bot/bot.py | 5 ++--- aiogram/types/poll.py | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 384e9221..41f30af1 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -872,8 +872,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): correct_option_id: typing.Optional[base.Integer] = None, explanation: typing.Optional[base.String] = None, explanation_parse_mode: typing.Optional[base.String] = None, - open_period: typing.Union[ - base.Integer, datetime.datetime, datetime.timedelta, None] = None, + open_period: typing.Union[base.Integer, None] = None, close_date: typing.Union[ base.Integer, datetime.datetime, datetime.timedelta, None] = None, is_closed: typing.Optional[base.Boolean] = None, @@ -908,7 +907,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :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. - :type open_period: :obj:`typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None]` + :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 is_closed: Pass True, if the poll needs to be immediately closed diff --git a/aiogram/types/poll.py b/aiogram/types/poll.py index 9e1315ca..a709edcd 100644 --- a/aiogram/types/poll.py +++ b/aiogram/types/poll.py @@ -1,9 +1,10 @@ +import datetime import typing -from ..utils import helper from . import base, fields from .message_entity import MessageEntity from .user import User +from ..utils import helper from ..utils.text_decorations import html_decoration, markdown_decoration @@ -48,6 +49,8 @@ class Poll(base.TelegramObject): correct_option_id: base.Integer = fields.Field() explanation: base.String = fields.Field() explanation_entities: base.String = fields.ListField(base=MessageEntity) + open_period: base.Integer = fields.Field() + close_date: datetime.datetime = fields.DateTimeField() def parse_entities(self, as_html=True): text_decorator = html_decoration if as_html else markdown_decoration From 233c6767557492e22c5abf86090f2c51b892d11e Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 17:54:15 +0300 Subject: [PATCH 12/15] i-AIOG-17 Add emoji to the Dice object --- aiogram/types/__init__.py | 3 ++- aiogram/types/dice.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py index 2cd15ac6..1221ec72 100644 --- a/aiogram/types/__init__.py +++ b/aiogram/types/__init__.py @@ -12,7 +12,7 @@ from .chat_permissions import ChatPermissions from .chat_photo import ChatPhoto from .chosen_inline_result import ChosenInlineResult from .contact import Contact -from .dice import Dice +from .dice import Dice, DiceEmoji from .document import Document from .encrypted_credentials import EncryptedCredentials from .encrypted_passport_element import EncryptedPassportElement @@ -85,6 +85,7 @@ __all__ = ( 'ContentType', 'ContentTypes', 'Dice', + 'DiceEmoji', 'Document', 'EncryptedCredentials', 'EncryptedPassportElement', diff --git a/aiogram/types/dice.py b/aiogram/types/dice.py index 9d0e22d0..121b90b4 100644 --- a/aiogram/types/dice.py +++ b/aiogram/types/dice.py @@ -9,5 +9,10 @@ class Dice(base.TelegramObject): https://core.telegram.org/bots/api#dice """ - + emoji: base.String = fields.Field() value: base.Integer = fields.Field() + + +class DiceEmoji: + DICE = '🎲' + DARTS = '🎯' From f2c7236ec16f38739f7142a7f81baa482353b9c3 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 22:52:48 +0300 Subject: [PATCH 13/15] i-AIOG-17: Rename dart constant --- aiogram/types/dice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiogram/types/dice.py b/aiogram/types/dice.py index 121b90b4..6dfb190f 100644 --- a/aiogram/types/dice.py +++ b/aiogram/types/dice.py @@ -15,4 +15,4 @@ class Dice(base.TelegramObject): class DiceEmoji: DICE = '🎲' - DARTS = '🎯' + DART = '🎯' From f1f65d2e776e9263e97ab76a17cecb0400f113d6 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 22:54:44 +0300 Subject: [PATCH 14/15] i-AIOG-18 Update versions (readme, setup, etc.) --- README.md | 2 +- README.rst | 2 +- aiogram/__init__.py | 4 ++-- aiogram/bot/api.py | 2 +- docs/source/index.rst | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a4c5b5fc..74de8a8d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![PyPi status](https://img.shields.io/pypi/status/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![Downloads](https://img.shields.io/pypi/dm/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![Supported python versions](https://img.shields.io/pypi/pyversions/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) -[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.7-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) +[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.8-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) [![Documentation Status](https://img.shields.io/readthedocs/aiogram?style=flat-square)](http://docs.aiogram.dev/en/latest/?badge=latest) [![Github issues](https://img.shields.io/github/issues/aiogram/aiogram.svg?style=flat-square)](https://github.com/aiogram/aiogram/issues) [![MIT License](https://img.shields.io/pypi/l/aiogram.svg?style=flat-square)](https://opensource.org/licenses/MIT) diff --git a/README.rst b/README.rst index 39c5ac25..78dc071c 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,7 @@ AIOGramBot :target: https://pypi.python.org/pypi/aiogram :alt: Supported python versions -.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-4.6-blue.svg?style=flat-square&logo=telegram +.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-4.8-blue.svg?style=flat-square&logo=telegram :target: https://core.telegram.org/bots/api :alt: Telegram Bot API diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 169eed5f..f06827cd 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -38,5 +38,5 @@ __all__ = [ 'utils' ] -__version__ = '2.6.1' -__api_version__ = '4.6' +__version__ = '2.8' +__api_version__ = '4.8' diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index f0553644..3b341ec9 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -153,7 +153,7 @@ class Methods(Helper): """ Helper for Telegram API Methods listed on https://core.telegram.org/bots/api - List is updated to Bot API 4.6 + List is updated to Bot API 4.8 """ mode = HelperMode.lowerCamelCase diff --git a/docs/source/index.rst b/docs/source/index.rst index 71ed04d9..b18d386e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -22,7 +22,7 @@ Welcome to aiogram's documentation! :target: https://pypi.python.org/pypi/aiogram :alt: Supported python versions - .. image:: https://img.shields.io/badge/Telegram%20Bot%20API-4.6-blue.svg?style=flat-square&logo=telegram + .. image:: https://img.shields.io/badge/Telegram%20Bot%20API-4.8-blue.svg?style=flat-square&logo=telegram :target: https://core.telegram.org/bots/api :alt: Telegram Bot API From b0870b3f93d208662e4da4c9f7b9e4dc3d9efdaf Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 25 Apr 2020 23:11:52 +0300 Subject: [PATCH 15/15] i-AIOG-16 update send dice aliases --- aiogram/types/message.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index 4dd853ac..ddbccde6 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -150,7 +150,6 @@ class Message(base.TelegramObject): if self.passport_data: return ContentType.PASSPORT_DATA - return ContentType.UNKNOWN def is_command(self): @@ -810,7 +809,8 @@ 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, + async def answer_dice(self, emoji: typing.Union[base.String, None] = None, + disable_notification: typing.Union[base.Boolean, None] = None, reply_markup: typing.Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, @@ -824,6 +824,8 @@ class Message(base.TelegramObject): Source: https://core.telegram.org/bots/api#senddice + :param emoji: Emoji on which the dice throw animation is based. Currently, must be one of “🎲” or “🎯”. Defauts to “🎲” + :type emoji: :obj:`typing.Union[base.String, None]` :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, @@ -836,6 +838,7 @@ class Message(base.TelegramObject): """ return await self.bot.send_dice(chat_id=self.chat.id, disable_notification=disable_notification, + emoji=emoji, reply_to_message_id=self.message_id if reply else None, reply_markup=reply_markup) @@ -1381,7 +1384,8 @@ 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, + async def reply_dice(self, emoji: typing.Union[base.String, None] = None, + disable_notification: typing.Union[base.Boolean, None] = None, reply_markup: typing.Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, @@ -1395,6 +1399,8 @@ class Message(base.TelegramObject): Source: https://core.telegram.org/bots/api#senddice + :param emoji: Emoji on which the dice throw animation is based. Currently, must be one of “🎲” or “🎯”. Defauts to “🎲” + :type emoji: :obj:`typing.Union[base.String, None]` :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,