mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Remove unwanted autocast in messages.discardEncryption
This commit is contained in:
parent
5e5fe5876a
commit
21a8a50ab9
|
@ -34,6 +34,18 @@ NAMED_AUTO_CASTS = {
|
||||||
('chat_id', 'int'): 'await client.get_peer_id({}, add_mark=False)'
|
('chat_id', 'int'): 'await client.get_peer_id({}, add_mark=False)'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Secret chats have a chat_id which may be negative.
|
||||||
|
# With the named auto-cast above, we would break it.
|
||||||
|
# However there are plenty of other legit requests
|
||||||
|
# with `chat_id:int` where it is useful.
|
||||||
|
#
|
||||||
|
# NOTE: This works because the auto-cast is not recursive.
|
||||||
|
# There are plenty of types that would break if we
|
||||||
|
# did recurse into them to resolve them.
|
||||||
|
NAMED_BLACKLIST = {
|
||||||
|
'messages.discardEncryption'
|
||||||
|
}
|
||||||
|
|
||||||
BASE_TYPES = ('string', 'bytes', 'int', 'long', 'int128',
|
BASE_TYPES = ('string', 'bytes', 'int', 'long', 'int128',
|
||||||
'int256', 'double', 'Bool', 'true', 'date')
|
'int256', 'double', 'Bool', 'true', 'date')
|
||||||
|
|
||||||
|
@ -253,7 +265,8 @@ def _write_class_init(tlobject, kind, type_constructors, builder):
|
||||||
def _write_resolve(tlobject, builder):
|
def _write_resolve(tlobject, builder):
|
||||||
if tlobject.is_function and any(
|
if tlobject.is_function and any(
|
||||||
(arg.type in AUTO_CASTS
|
(arg.type in AUTO_CASTS
|
||||||
or ((arg.name, arg.type) in NAMED_AUTO_CASTS))
|
or ((arg.name, arg.type) in NAMED_AUTO_CASTS
|
||||||
|
and tlobject.fullname not in NAMED_BLACKLIST))
|
||||||
for arg in tlobject.real_args
|
for arg in tlobject.real_args
|
||||||
):
|
):
|
||||||
builder.writeln('async def resolve(self, client, utils):')
|
builder.writeln('async def resolve(self, client, utils):')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user