Lonami Exo
77be6a2755
Update to v1.5.1
2019-01-03 19:43:48 +01:00
Lonami Exo
eda8d0dbc8
Support configuring the reply markup through buttons
2019-01-03 19:03:47 +01:00
Lonami Exo
2631144702
Add more properties to the client to make media more convenient
2019-01-03 18:34:29 +01:00
Lonami Exo
4ccabaf422
Add friendly method to get admin log ( #952 )
2019-01-03 13:09:59 +01:00
Lonami Exo
95cf873bad
Don't mark the user as connected until successfull connection
...
The idea behind distinguishing between the user being connected and
the actual connection having been made was to support retries while
the user decided to connect, even if the connection wasn't made yet.
The problem is that _user_connected is used directly to tell whether
the sender is connected or not which will be wrong if an exception
occurs on the initial connection. Since the logic retry isn't used
there we can simply mark as connected once a successfull connection
is made.
2019-01-02 10:53:10 +01:00
Lonami Exo
229969192a
Fix UnicodeDecodeError with malformed input on unparse text
2019-01-01 20:31:39 +01:00
Lonami Exo
619e4dc2d6
Fix get_peer for int which made ab557a8
useless
2018-12-28 17:54:15 +01:00
Lonami Exo
4ad9c9bf31
Add TLObject.to_json() for convenience
2018-12-27 20:15:35 +01:00
Lonami Exo
f1157b8fd1
Return downloaded bytes when file=bytes
2018-12-27 19:05:52 +01:00
Lonami Exo
342a4dd502
Update to v1.5
2018-12-25 17:55:15 +01:00
Lonami Exo
fc46e1ec20
Workaround file references by using empty byte strings for cache
...
They seem to work for now, so until there is a need to update it,
cache will just rely on empty byte strings for the file_reference.
2018-12-25 17:02:33 +01:00
Lonami Exo
b66c1e6084
Revert "Get rid of now broken cache"
...
This reverts commit f73ae42a03
.
2018-12-25 16:50:11 +01:00
Lonami Exo
a6c3c382b4
Except MessageIdsEmptyError when getting messages by ID
...
This error may occur even when the IDs are not actually empty.
2018-12-25 12:17:24 +01:00
Lonami Exo
f73ae42a03
Get rid of now broken cache
2018-12-25 11:44:10 +01:00
Lonami Exo
382106aafb
Check g when password's prime is known to be good
2018-12-25 10:59:16 +01:00
Lonami Exo
18f457a41d
Add missing file_reference to InputDocument
2018-12-25 01:04:45 +01:00
Aaron Gallagher
b0e0bc3701
Extend new_algo.salt1 to fix edit_2fa ( #1072 )
...
The salt1 that is sent to the server requires an additional 32 bytes
of random data. It's easy to miss this requirement from reading the
tdesktop source, because this extension is done in a function called
`ValidateNewCloudPasswordAlgo`.
https://github.com/telegramdesktop/tdesktop/blob/2e5a0e056cdb40d61d487c6062bffe1a835f
6ddd/Telegram/SourceFiles/core/core_cloud_password.cpp#L210-L211
2018-12-24 21:16:09 +01:00
Lonami Exo
deb6ca0da0
Fast-path good known prime in 2fa
2018-12-24 20:17:31 +01:00
Lonami Exo
de74711e82
Implement click for KeyboardButtonGame
2018-12-24 17:56:30 +01:00
Lonami Exo
f16ed8235c
Add new is_bot method to check if the logged-in user is a bot
2018-12-24 17:32:34 +01:00
Lonami Exo
ab557a8cef
Use getUsers/getChannels with hash 0 on get_input_entity
2018-12-24 17:32:16 +01:00
Lonami Exo
46fea3fc93
Implement clearing password in edit_2fa
2018-12-24 16:30:45 +01:00
Lonami Exo
6823b6c691
Remove old code to get the hash of a password
2018-12-24 14:47:39 +01:00
Lonami Exo
d2ac7e5b0a
Actually perform all checks in 2fa
2018-12-24 14:16:50 +01:00
Lonami Exo
a623006ea0
Update 2fa code to layer 91
2018-12-24 14:10:15 +01:00
Lonami Exo
2aa089f29c
Prevent KeyError in forward_messages
2018-12-20 20:33:25 +01:00
Kyle2142
d3feaeedb2
Prevent caption=None from crashing ( #1071 )
2018-12-20 10:50:16 +01:00
Lonami Exo
7100b75598
Update to layer 89
...
This breaks edit_2fa
2018-12-18 16:37:07 +01:00
Lonami Exo
09f994c105
Except TypeError on empty access hash from 5018879
thoroughly
2018-12-18 08:39:36 +01:00
Lonami Exo
5018879f84
Raise TypeError in get_input_peer if access_hash is None
...
When auto-casting to input peers if the access hash is now None,
the ID will be used to look-up a cached access hash which will
solve some common pitfalls (using full entities when only the
input variant should and could be used).
2018-12-15 12:23:14 +01:00
Lonami Exo
7ee7b43547
Be explicit that phone numbers only work if in your contacts
2018-12-15 12:04:36 +01:00
Sister Midnight
f3013c6817
Fix ConnectionHttp SSL socket wrap ( #1064 )
2018-12-10 14:43:48 +01:00
Lonami Exo
c48d41d99d
Expect ConnectionError in the send loop
2018-12-06 16:27:09 +01:00
Lonami Exo
f9fc433c0f
Better catch_up behaviour when invalid states are present
2018-12-06 16:07:11 +01:00
Lonami Exo
40730e7862
Fix aaee092
to correct entities' offsets on stripping
2018-12-06 12:33:15 +01:00
Lonami Exo
424079aa12
Fix pts initialized as -1 not being considered
2018-12-04 21:07:18 +01:00
Lonami Exo
0b89d9d3f9
Update to v1.4.3
2018-12-04 14:09:17 +01:00
Lonami Exo
4d8f078ad9
Fix _document_by_attribute calls using cond
2018-12-03 08:49:24 +01:00
Lonami Exo
ed1bcb509f
Use InputMessageReplyTo in get_reply_message
...
This lets bots access to messages other bots sent through replies.
2018-11-29 14:21:49 +01:00
Lonami Exo
9a6f4d35f2
Fix crash on get_messages(ids=InputMessageReplyTo)
2018-11-29 14:19:56 +01:00
Lonami Exo
10b9b4b969
Handle TimeoutError on automatic reconnect
2018-11-29 13:11:34 +01:00
Lonami Exo
4a8a85d7a6
Refetch ChatAction service message to get input users
2018-11-28 18:59:49 +01:00
Lonami Exo
16dd47f5ec
Update to v1.4.2
2018-11-24 20:53:28 +01:00
Lonami Exo
d2e995ef95
Change code to recv and handle disconnections
2018-11-24 20:53:28 +01:00
Lonami Exo
09b16f96fc
Better behaviour for send_read_acknowledge
2018-11-24 20:53:28 +01:00
painor
7e168cb4fb
Remove invalid mentions from message entities ( #1049 )
2018-11-24 19:39:05 +01:00
udf
5b2cfffedc
make utils.get_peer_id raise with message about InputPeerSelf
2018-11-23 16:39:31 +01:00
udf
9362f03fd5
fix utils.get_peer not raising in some cases
2018-11-23 16:39:31 +01:00
Lonami Exo
d214c78bd0
Add missing @property decorator
2018-11-19 12:06:18 +01:00
Lonami Exo
aaee092a46
Locally strip outgoing message text respecting entities
2018-11-19 10:15:56 +01:00
Lonami Exo
d854babf22
Make HTML parser yield the correct offset and lengths
2018-11-19 09:20:13 +01:00
Lonami Exo
d6ec883cd9
Ignore iter_messages from_user unless it's a User
2018-11-19 08:55:49 +01:00
Lonami Exo
8ed3ddba31
Clarify iter_participants filter parameter in the docs
2018-11-19 08:38:31 +01:00
Lonami Exo
207d5ebdcb
Avoid packing more than 1024 messages in a single container
2018-11-19 08:29:44 +01:00
Lonami Exo
0f7c2b891a
Fix get entity by exact name since 2ca8ddb
2018-11-15 17:23:47 +01:00
Lonami Exo
924b59d735
Actually fix cancelling custom conversations from f6bc80b
2018-11-12 08:21:18 +01:00
Lonami Exo
dfab8f5e20
Avoid caching event loop in telethon.sync
...
This would cause issues when creating and setting a different
event loop from a different thread since it would use the old
loop and not the new one, solved by explicitly getting the
loop every time, although this has a slight performance hit.
2018-11-10 11:34:26 +01:00
Lonami Exo
f046d1f0a3
Fix deadlock on unexpected disconnections
2018-11-10 11:23:19 +01:00
Lonami Exo
f6bc80bc6b
Fix cancellation of custom conversation events from d474458
2018-11-08 10:08:41 +01:00
Lonami Exo
cdbd1f6193
Fix valid auth_key never being saved after switching DC
2018-11-03 18:53:26 +01:00
Lonami Exo
0fc97a3e8c
Update to v1.4
2018-11-03 12:46:19 +01:00
Lonami Exo
8e6b98669a
Get rid of full_sync
2018-11-03 12:46:19 +01:00
K900
20a8081e8e
Fix file cache when using MemorySession ( #1033 )
2018-11-01 10:29:23 +01:00
Lonami Exo
67c5572d7b
Possibly fix possible deadlock
2018-10-28 11:53:28 +01:00
painor
45999001be
Added retry_delay parameter for auto-reconnection ( #1031 )
2018-10-28 10:55:58 +01:00
Lonami Exo
24970a875a
Fix raising PasswordHashInvalid missing request arg too
2018-10-27 09:40:30 +02:00
Lonami Exo
2863eb8cc9
Fix raising local FloodWait missing request argument
2018-10-27 09:39:00 +02:00
Lonami Exo
b0e587c03d
Except expected ConnectionError in the receive loop
2018-10-26 10:36:33 +02:00
Lonami Exo
091180b32d
Except CancelledError in MTProtoSender send/recv loop
...
This way, the tasks should not end with the cancelled exception
which should get rid of the warning if any.
2018-10-25 15:54:25 +02:00
Kyle2142
eacfa226fd
Add Conversation.cancel() ( #1030 )
2018-10-25 15:37:36 +02:00
Lonami Exo
2c61c50671
Save session on connect and fix some typos
...
The session is saved upon connecting with the hope to make
sure that the authorization key gets saved to disk before
the next run.
2018-10-24 16:39:59 +02:00
Lonami Exo
4562ba9ccf
Fix auth_key not actually being saved
...
This would make the user have to login every time.
2018-10-22 20:58:07 +02:00
Lonami Exo
7dece209a0
Cancel tasks on reconnect instead of awaiting them
...
This prevents us from locking forever on any task that doesn't
rely on cancellation tokens, in this case, Connection.recv()'s
_recv_queue.get() would never complete after the server closed
the connection.
Additionally, working with cancellation tokens in asyncio is
somewhat annoying to do.
Last but not least removing the Connection._disconnected future
avoids the need to use its state (if an exception was set it
should be retrieved) to prevent asyncio from complaining, which
it was before.
2018-10-21 16:20:05 +02:00
Lonami Exo
f2e77f4030
Fix using the wrong logger in Connection
2018-10-21 16:10:09 +02:00
Lonami Exo
740a715acd
Handle empty code when starting
2018-10-21 16:05:31 +02:00
Lonami Exo
0755421fc2
Fix update loop should not disconnect causing race condition
...
When starting the client, on phone migrations, it would
disconnect twice right after connecting which would
trigger a not-connected error.
2018-10-21 16:02:13 +02:00
Lonami Exo
396ec908dd
Fix _borrow_exported_sender connection
2018-10-20 17:11:40 +02:00
Lonami Exo
39929db2b8
Patch __enter__/__exit__ specially in full_sync
2018-10-19 18:04:53 +02:00
Lonami Exo
a2bae8374e
Fix .get_entity('me') not working from c31635c
( #1024 )
2018-10-19 16:57:46 +02:00
Lonami Exo
0686ec4440
Implement after_msg_id back
2018-10-19 16:53:50 +02:00
Lonami Exo
9dc4009152
Handle the right errors
2018-10-19 14:41:50 +02:00
Lonami Exo
b93b01cb02
Fix manual BadMessageError instantiation
2018-10-19 14:02:20 +02:00
Lonami Exo
6b280dc3bd
Clarify MTProtoSender._disconnected
2018-10-19 14:01:03 +02:00
Lonami Exo
945b34b103
Set MTProtoSender.auth_key on its creation
2018-10-19 13:56:11 +02:00
Lonami Exo
8563b9560d
Fix auth_key not being set
2018-10-19 13:35:29 +02:00
Lonami Exo
939854a0dd
Fix-up e2fe3eb
(packer was OK, encryption was not made)
2018-10-19 13:33:24 +02:00
Lonami Exo
f5bc952309
Don't set the disconnected flag twice
2018-10-19 13:25:00 +02:00
Lonami Exo
e2fe3eb503
Use new broken MessagePacker
2018-10-19 13:24:52 +02:00
Lonami Exo
83f60deef9
Allow updating AuthKey.key
...
This will preserve references to the AuthKey more cleanly.
2018-10-19 12:40:36 +02:00
Lonami Exo
6d30a38316
Let Connection._disconnected be a proper Future
...
This means that awaiting on disconnect will properly raise errors,
allowing to differentiate clean disconnects from faulty ones.
2018-10-19 10:46:34 +02:00
Lonami Exo
542d0f539b
Revisit connection and properly detail the class' intent
2018-10-19 10:35:22 +02:00
Lonami Exo
e5fc9d8674
Fix several broken links in the docs
2018-10-17 11:50:11 +02:00
Lonami Exo
a9a2401e44
Fix CallbackQuery using string regex
2018-10-17 11:44:08 +02:00
Lonami Exo
419fe6dca3
Raise RuntimeError on with blocks that need async
2018-10-17 11:30:07 +02:00
Lonami Exo
9cbc088b76
Make disconnect synchronous
...
This also fixes a bug when auto-reconnecting in MTProtoSender.
2018-10-16 11:56:17 +02:00
Lonami Exo
b219da6b87
Fix Dialog.is_group for types.ChatForbidden
2018-10-15 18:43:53 +02:00
Lonami Exo
34cefed9ff
Except BotMethodInvalidError on getContacts
2018-10-15 18:42:35 +02:00
Lonami Exo
99129daeee
Show the request that caused RPC errors in their messages
2018-10-15 18:35:51 +02:00
Lonami Exo
0094eb391e
Support exclusive conversations by default
2018-10-12 22:17:07 +02:00
Lonami Exo
cf6686ff42
Revert async sessions from 3dd8b7c
(breaks sync properties)
...
Such as ChatGetter.input_chat and SenderGetter.input_sender
which rely on the fact that access to the session file will
be synchronous.
2018-10-12 22:00:02 +02:00
Lonami Exo
e677a6bb05
Fix is_user_authorized after log_out
2018-10-12 19:57:16 +02:00
Lonami Exo
6e77f583f1
Detect arbitrary negative HTTP error codes
2018-10-12 19:47:40 +02:00
Lonami Exo
74f7ae525f
Document InlineBuilder
2018-10-12 12:38:46 +02:00
Lonami Exo
9ee415749d
Fix InlineBuilder.photo/document and clearer errors
2018-10-12 11:50:36 +02:00
Lonami Exo
32c884d543
Revert d392939
and use empty tuple as a sentinel value
2018-10-08 11:33:56 +02:00
Lonami Exo
27345d5749
Work around importing sync and using full_sync
2018-10-08 11:13:24 +02:00
Lonami Exo
2d94a104d1
Syncify events too
2018-10-06 21:08:38 +02:00
Lonami Exo
ded24db3dd
Fix proxy support by removing conflicting arguments
2018-10-06 20:56:09 +02:00
Lonami Exo
8c14259728
Update documentation with new sections
2018-10-06 20:20:11 +02:00
Lonami Exo
fb9660afe0
Add missing awaits
2018-10-06 12:39:07 +02:00
Lonami Exo
67be6418b6
Remove callback parameter from custom.Button
...
Its behaviour was strange. Removing and adding an event
handler every time a message is sent is not a good idea
and it would just do more harm than good.
2018-10-05 20:54:50 +02:00
josephbiko
3dd8b7c6d1
Support async def in sessions ( #1013 )
2018-10-05 20:25:49 +02:00
Tulir Asokan
653f3c043d
Add full_sync module ( #1016 )
2018-10-05 19:59:56 +02:00
Lonami Exo
d392939018
Create a default module to use as a sentinel value
...
This looks better in the documentation than utils.Default,
cleans the utils with specific stuff like this, and users
may use it more easily.
2018-10-05 14:20:50 +02:00
Lonami Exo
0fcc2e5e52
Add autocast for InputDocument and InputChatPhoto
2018-10-05 14:11:47 +02:00
Lonami Exo
aa3f26263c
Fix timeout not accepting timedelta
2018-10-05 14:06:15 +02:00
Lonami Exo
dedbf29ca4
Fix Conversation.wait_event not resolving them (from d474458
)
2018-10-05 13:42:07 +02:00
Lonami Exo
dc77136453
Don't expect responses from ack, log send errors, remove TODOs
2018-10-05 13:26:44 +02:00
Lonami Exo
ef60ade647
Rewrite container packing to support arbitrary sizes
2018-10-05 13:26:44 +02:00
Lonami Exo
7e7bbcf4c0
Remove irrelevant TODOs and add more logging
2018-10-05 13:26:44 +02:00
Lonami Exo
a5d4e97922
Fix alternative connection modes
2018-10-05 13:26:44 +02:00
Lonami Exo
ebde3be820
Add support for proxy again
2018-10-05 13:26:44 +02:00
Lonami Exo
db83709c6b
Support connection timeout
2018-10-05 13:26:44 +02:00
Lonami Exo
0cc8bca098
Delete TcpClient
2018-10-05 13:26:44 +02:00
Lonami Exo
1b9d6aac06
Gzip only content related data
2018-10-05 13:26:44 +02:00
Lonami Exo
37b9922f64
Handle cancellation on the receive loop
2018-10-05 13:26:44 +02:00
Lonami Exo
e319fa3aa9
Handle IncompleteReadError and InvalidChecksumError
2018-10-05 13:26:44 +02:00
Lonami Exo
3fd7c33127
Fix automatic reconnect (e.g. on bad auth key)
...
This took more time than it should have to debug.
2018-10-05 13:26:44 +02:00
Lonami Exo
bc1fd9039d
Handle receiving errors
2018-10-05 13:26:44 +02:00
Lonami Exo
cf7e5d5592
Set auth_key on connection
2018-10-05 13:26:44 +02:00
Lonami Exo
21ffa2f26b
Fix DC migration and seqno
2018-10-05 13:26:44 +02:00
Lonami Exo
ac567ebf1d
Handle bad salt/msg not resending containers
2018-10-05 13:26:44 +02:00
Lonami Exo
3b1142aaca
Add back auth key generation process
2018-10-05 13:26:44 +02:00
Lonami Exo
5edc2216c7
Handle initial connection if network is down correctly
2018-10-05 13:26:44 +02:00
Lonami Exo
2d275989cb
Properly handle cancellation in _ReadyQueue
2018-10-05 13:26:44 +02:00
Lonami Exo
105bd52eee
Abstract the send queue off MTProtoSender
2018-10-05 13:26:44 +02:00
Lonami Exo
b02ebcb69b
Stop waiting for send items on disconnection
2018-10-05 13:26:44 +02:00
Lonami Exo
470fb9f5df
Make use of the MTProtoLayer in MTProtoSender
2018-10-05 13:26:44 +02:00
Lonami Exo
9402b4a26d
Create a new layer to lift encryption off the MTProtoSender
2018-10-05 13:26:44 +02:00
Lonami Exo
5daad2aaab
Actually use the new connection class
2018-10-05 13:26:44 +02:00
Lonami Exo
daf94e416b
Fix connection never receiving and missing clone method
2018-10-05 13:26:44 +02:00
Lonami Exo
2fd51b8582
Let all connection modes implement the new Connection
2018-10-05 13:26:44 +02:00
Lonami Exo
096424ea78
Create a new Connection class to work through queues
2018-10-05 13:26:44 +02:00
painor
340f5614b5
Add name mention formatting to HTML and Markdown ( #1019 )
2018-10-04 15:56:32 +02:00
Manuel1510
2468b32fc5
Implement next_offset and allow empty results in answer() ( #1017 )
2018-10-04 09:12:12 +02:00
nailerNAS
c2966297f1
Add delete method to custom.Dialog ( #1014 )
2018-09-28 15:47:24 +02:00
Lonami Exo
785071a5cd
Update to v1.3
2018-09-22 19:37:16 +02:00
Lonami Exo
ec0aa65fe1
An user -> a user
2018-09-22 19:18:42 +02:00
Lonami Exo
d5d3733fd4
Create events.register and siblings for "handler templates"
...
This can be thought of as a different approach to Flask's blueprints.
2018-09-22 12:51:58 +02:00
Lonami Exo
cb6f980277
Better autocast to InputPeerDialog and documentation
2018-09-22 10:56:37 +02:00