mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Merge remote-tracking branch 'upstream/dev-1.x' into dev-1.x
This commit is contained in:
commit
bd8e1473c0
12 changed files with 35 additions and 19 deletions
|
|
@ -20,7 +20,7 @@ else:
|
|||
|
||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||
|
||||
VERSION = Version(1, 0, 5, stage=Stage.DEV, build=0)
|
||||
VERSION = Version(1, 1, 0, stage=Stage.FINAL, build=0)
|
||||
API_VERSION = Version(3, 5)
|
||||
|
||||
__version__ = VERSION.version
|
||||
|
|
|
|||
|
|
@ -907,8 +907,8 @@ class Bot(BaseBot):
|
|||
|
||||
async def export_chat_invite_link(self, chat_id: typing.Union[base.Integer, base.String]) -> base.String:
|
||||
"""
|
||||
Use this method to export an invite link to a supergroup or a channel.
|
||||
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||
Use this method to generate a new invite link for a chat; any previously generated link is revoked.
|
||||
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#exportchatinvitelink
|
||||
|
||||
|
|
|
|||
|
|
@ -444,8 +444,6 @@ class Dispatcher:
|
|||
:param kwargs:
|
||||
:return: decorated function
|
||||
"""
|
||||
if commands is None:
|
||||
commands = []
|
||||
if content_types is None:
|
||||
content_types = ContentType.TEXT
|
||||
if custom_filters is None:
|
||||
|
|
@ -509,8 +507,6 @@ class Dispatcher:
|
|||
:param kwargs:
|
||||
:return: decorated function
|
||||
"""
|
||||
if commands is None:
|
||||
commands = []
|
||||
if content_types is None:
|
||||
content_types = ContentType.TEXT
|
||||
if custom_filters is None:
|
||||
|
|
@ -566,8 +562,6 @@ class Dispatcher:
|
|||
:param kwargs:
|
||||
:return: decorated function
|
||||
"""
|
||||
if commands is None:
|
||||
commands = []
|
||||
if content_types is None:
|
||||
content_types = ContentType.TEXT
|
||||
if custom_filters is None:
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ class Message(base.TelegramObject):
|
|||
return ContentType.VENUE[0]
|
||||
if self.new_chat_members:
|
||||
return ContentType.NEW_CHAT_MEMBERS[0]
|
||||
if self.left_chat_member:
|
||||
return ContentType.LEFT_CHAT_MEMBER[0]
|
||||
if self.invoice:
|
||||
return ContentType.INVOICE[0]
|
||||
if self.successful_payment:
|
||||
|
|
@ -655,6 +657,7 @@ class ContentType(helper.Helper):
|
|||
:key: LOCATION
|
||||
:key: VENUE
|
||||
:key: NEW_CHAT_MEMBERS
|
||||
:key: LEFT_CHAT_MEMBER
|
||||
:key: INVOICE
|
||||
:key: SUCCESSFUL_PAYMENT
|
||||
"""
|
||||
|
|
@ -673,6 +676,7 @@ class ContentType(helper.Helper):
|
|||
LOCATION = helper.ListItem() # location
|
||||
VENUE = helper.ListItem() # venue
|
||||
NEW_CHAT_MEMBERS = helper.ListItem() # new_chat_member
|
||||
LEFT_CHAT_MEMBER = helper.ListItem() # left_chat_member
|
||||
INVOICE = helper.ListItem() # invoice
|
||||
SUCCESSFUL_PAYMENT = helper.ListItem() # successful_payment
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class User(base.TelegramObject):
|
|||
as_html = True
|
||||
|
||||
if name is None:
|
||||
name = self.mention
|
||||
name = self.full_name
|
||||
if as_html:
|
||||
return markdown.hlink(name, self.url)
|
||||
return markdown.link(name, self.url)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@ Data types
|
|||
|
||||
Bases
|
||||
-----
|
||||
:class:`aiogram.types.base.Serializable`
|
||||
|
||||
:class:`aiogram.types.base.Deserializable`
|
||||
|
||||
.. automodule:: aiogram.types.base
|
||||
:members:
|
||||
|
|
@ -210,6 +207,16 @@ ResponseParameters
|
|||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
InputMedia
|
||||
----------
|
||||
:class:`aiogram.types.InputMediaPhoto`
|
||||
:class:`aiogram.types.InputMediaVideo`
|
||||
:class:`aiogram.types.MediaGroup`
|
||||
|
||||
.. automodule:: aiogram.types.input_media
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
Sticker
|
||||
-------
|
||||
:class:`aiogram.types.Sticker`
|
||||
|
|
@ -299,3 +306,13 @@ Games
|
|||
.. automodule:: aiogram.types.game_high_score
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
InputFile interface
|
||||
-------------------
|
||||
|
||||
:class:`aiogram.types.InputFile`
|
||||
|
||||
.. automodule:: aiogram.types.input_file
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -39,7 +39,7 @@ install_requires = get_requirements()
|
|||
setup(
|
||||
name='aiogram',
|
||||
version=VERSION.version,
|
||||
packages=PackageFinder.find(exclude=('tests', 'examples', 'docs',)),
|
||||
packages=PackageFinder.find(exclude=('tests', 'tests.*', 'examples.*', 'docs',)),
|
||||
url='https://github.com/aiogram/aiogram',
|
||||
license='MIT',
|
||||
author='Alex Root Junior',
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ def test_export():
|
|||
def test_id():
|
||||
assert isinstance(chat.id, int)
|
||||
assert chat.id == CHAT['id']
|
||||
assert hash(chat) == CHAT['id']
|
||||
# assert hash(chat) == CHAT['id']
|
||||
|
||||
|
||||
def test_name():
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from .dataset import GAME
|
|||
|
||||
game = types.Game(**GAME)
|
||||
|
||||
|
||||
def test_export():
|
||||
exported = game.to_python()
|
||||
assert isinstance(exported, dict)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ def test_export():
|
|||
|
||||
|
||||
def test_message_id():
|
||||
assert hash(message) == MESSAGE['message_id']
|
||||
# assert hash(message) == MESSAGE['message_id']
|
||||
assert message.message_id == MESSAGE['message_id']
|
||||
assert message['message_id'] == MESSAGE['message_id']
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ def test_export():
|
|||
|
||||
def test_update_id():
|
||||
assert isinstance(update.update_id, int)
|
||||
assert hash(update) == UPDATE['update_id']
|
||||
# assert hash(update) == UPDATE['update_id']
|
||||
assert update.update_id == UPDATE['update_id']
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ def test_export():
|
|||
def test_id():
|
||||
assert isinstance(user.id, int)
|
||||
assert user.id == USER['id']
|
||||
assert hash(user) == USER['id']
|
||||
# assert hash(user) == USER['id']
|
||||
|
||||
|
||||
def test_bot():
|
||||
|
|
@ -40,7 +40,7 @@ def test_full_name():
|
|||
|
||||
def test_mention():
|
||||
assert user.mention == f"@{USER['username']}"
|
||||
assert user.get_mention('foo') == f"[foo](tg://user?id={USER['id']})"
|
||||
assert user.get_mention('foo', as_html=False) == f"[foo](tg://user?id={USER['id']})"
|
||||
assert user.get_mention('foo', as_html=True) == f"<a href=\"tg://user?id={USER['id']}\">foo</a>"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue