mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-09-21 19:32:39 +03:00
Compare commits
No commits in common. "v1" and "v1.41.0" have entirely different histories.
|
@ -343,7 +343,7 @@ class UpdateMethods:
|
||||||
if updates:
|
if updates:
|
||||||
self._log[__name__].info('Got difference for account updates')
|
self._log[__name__].info('Got difference for account updates')
|
||||||
|
|
||||||
_preprocess_updates = await self._preprocess_updates(updates, users, chats)
|
_preprocess_updates = await utils.maybe_async(self._preprocess_updates(updates, users, chats))
|
||||||
updates_to_dispatch.extend(_preprocess_updates)
|
updates_to_dispatch.extend(_preprocess_updates)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ class UpdateMethods:
|
||||||
if updates:
|
if updates:
|
||||||
self._log[__name__].info('Got difference for channel %d updates', get_diff.channel.channel_id)
|
self._log[__name__].info('Got difference for channel %d updates', get_diff.channel.channel_id)
|
||||||
|
|
||||||
_preprocess_updates = await self._preprocess_updates(updates, users, chats)
|
_preprocess_updates = await utils.maybe_async(self._preprocess_updates(updates, users, chats))
|
||||||
updates_to_dispatch.extend(_preprocess_updates)
|
updates_to_dispatch.extend(_preprocess_updates)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ class UpdateMethods:
|
||||||
except GapError:
|
except GapError:
|
||||||
continue # get(_channel)_difference will start returning requests
|
continue # get(_channel)_difference will start returning requests
|
||||||
|
|
||||||
_preprocess_updates = await self._preprocess_updates(processed, users, chats)
|
_preprocess_updates = await utils.maybe_async(self._preprocess_updates(processed, users, chats))
|
||||||
updates_to_dispatch.extend(_preprocess_updates)
|
updates_to_dispatch.extend(_preprocess_updates)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -438,9 +438,9 @@ def get_input_media(
|
||||||
if media.SUBCLASS_OF_ID == 0xfaf846f4: # crc32(b'InputMedia')
|
if media.SUBCLASS_OF_ID == 0xfaf846f4: # crc32(b'InputMedia')
|
||||||
return media
|
return media
|
||||||
elif media.SUBCLASS_OF_ID == 0x846363e0: # crc32(b'InputPhoto')
|
elif media.SUBCLASS_OF_ID == 0x846363e0: # crc32(b'InputPhoto')
|
||||||
return types.InputMediaPhoto(media, ttl_seconds=ttl)
|
return types.InputMediaPhoto(media, ttl_seconds=ttl, spoiler=media.spoiler)
|
||||||
elif media.SUBCLASS_OF_ID == 0xf33fdb68: # crc32(b'InputDocument')
|
elif media.SUBCLASS_OF_ID == 0xf33fdb68: # crc32(b'InputDocument')
|
||||||
return types.InputMediaDocument(media, ttl_seconds=ttl)
|
return types.InputMediaDocument(media, ttl_seconds=ttl, spoiler=media.spoiler)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
_raise_cast_fail(media, 'InputMedia')
|
_raise_cast_fail(media, 'InputMedia')
|
||||||
|
|
||||||
|
@ -460,7 +460,6 @@ def get_input_media(
|
||||||
if isinstance(media, types.MessageMediaDocument):
|
if isinstance(media, types.MessageMediaDocument):
|
||||||
return types.InputMediaDocument(
|
return types.InputMediaDocument(
|
||||||
id=get_input_document(media.document),
|
id=get_input_document(media.document),
|
||||||
spoiler=media.spoiler,
|
|
||||||
ttl_seconds=ttl or media.ttl_seconds
|
ttl_seconds=ttl or media.ttl_seconds
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1095,8 +1094,6 @@ def _rle_encode(string):
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
new += bytes([cur])
|
new += bytes([cur])
|
||||||
if count != 0:
|
|
||||||
new += b'\0' + bytes([count])
|
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Versions should comply with PEP440.
|
# Versions should comply with PEP440.
|
||||||
# This line is parsed in setup.py:
|
# This line is parsed in setup.py:
|
||||||
__version__ = '1.41.2'
|
__version__ = '1.41.0'
|
||||||
|
|
|
@ -34,7 +34,6 @@ BOTS_TOO_MUCH,400,There are too many bots in this chat/channel
|
||||||
BOT_CHANNELS_NA,400,Bots can't edit admin privileges
|
BOT_CHANNELS_NA,400,Bots can't edit admin privileges
|
||||||
BOT_COMMAND_DESCRIPTION_INVALID,400,"The command description was empty, too long or had invalid characters used"
|
BOT_COMMAND_DESCRIPTION_INVALID,400,"The command description was empty, too long or had invalid characters used"
|
||||||
BOT_COMMAND_INVALID,400,The specified command is invalid
|
BOT_COMMAND_INVALID,400,The specified command is invalid
|
||||||
BOT_COMMANDS_TOO_MUCH,400,"The provided commands are too many"
|
|
||||||
BOT_DOMAIN_INVALID,400,The domain used for the auth button does not match the one configured in @BotFather
|
BOT_DOMAIN_INVALID,400,The domain used for the auth button does not match the one configured in @BotFather
|
||||||
BOT_GAMES_DISABLED,400,Bot games cannot be used in this type of chat
|
BOT_GAMES_DISABLED,400,Bot games cannot be used in this type of chat
|
||||||
BOT_GROUPS_BLOCKED,400,This bot can't be added to groups
|
BOT_GROUPS_BLOCKED,400,This bot can't be added to groups
|
||||||
|
|
|
|
@ -39,9 +39,9 @@ def test_strip_text():
|
||||||
|
|
||||||
class TestSyncifyAsyncContext:
|
class TestSyncifyAsyncContext:
|
||||||
class NoopContextManager:
|
class NoopContextManager:
|
||||||
def __init__(self):
|
def __init__(self, loop):
|
||||||
self.count = 0
|
self.count = 0
|
||||||
self.loop = helpers.get_running_loop()
|
self.loop = loop
|
||||||
|
|
||||||
async def __aenter__(self):
|
async def __aenter__(self):
|
||||||
self.count += 1
|
self.count += 1
|
||||||
|
@ -54,8 +54,8 @@ class TestSyncifyAsyncContext:
|
||||||
__enter__ = helpers._sync_enter
|
__enter__ = helpers._sync_enter
|
||||||
__exit__ = helpers._sync_exit
|
__exit__ = helpers._sync_exit
|
||||||
|
|
||||||
def test_sync_acontext(self):
|
def test_sync_acontext(self, event_loop):
|
||||||
contm = self.NoopContextManager()
|
contm = self.NoopContextManager(event_loop)
|
||||||
assert contm.count == 0
|
assert contm.count == 0
|
||||||
|
|
||||||
with contm:
|
with contm:
|
||||||
|
@ -64,8 +64,8 @@ class TestSyncifyAsyncContext:
|
||||||
assert contm.count == 0
|
assert contm.count == 0
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_async_acontext(self):
|
async def test_async_acontext(self, event_loop):
|
||||||
contm = self.NoopContextManager()
|
contm = self.NoopContextManager(event_loop)
|
||||||
assert contm.count == 0
|
assert contm.count == 0
|
||||||
|
|
||||||
async with contm:
|
async with contm:
|
||||||
|
|
|
@ -52,7 +52,3 @@ def test_private_get_extension():
|
||||||
assert utils._get_extension(empty_buffer) == ''
|
assert utils._get_extension(empty_buffer) == ''
|
||||||
assert utils._get_extension(empty_buffer) == '' # make sure it did seek back
|
assert utils._get_extension(empty_buffer) == '' # make sure it did seek back
|
||||||
assert utils._get_extension(CustomFd('foo')) == ''
|
assert utils._get_extension(CustomFd('foo')) == ''
|
||||||
|
|
||||||
|
|
||||||
def test_rle_encode_trailing_zeros():
|
|
||||||
assert utils._rle_encode(b'\x12\x00\x00\x00\x00') == b'\x12\x00\x04'
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user