Commit Graph

3126 Commits

Author SHA1 Message Date
Lonami Exo
13437cc3f2 Fix infinite recursion for custom.Message.message 2018-07-21 10:19:17 +02:00
Lonami Exo
aa67f107af Temporarily use blocking SSL sockets on connect 2018-07-19 20:56:45 +02:00
Lonami Exo
4027ac6a6f Wrap socket with SSL after connecting
See https://github.com/Anorov/PySocks/issues/29
2018-07-19 20:38:53 +02:00
Lonami Exo
7f78d7ed2f Use classmethod for all Event.build 2018-07-19 01:47:32 +02:00
Lonami Exo
2d7c8908eb Create events.InlineQuery 2018-07-15 11:31:24 +02:00
Lonami Exo
5017a9d1da Fix typos and add the URL_INVALID error 2018-07-14 10:43:24 +02:00
Lonami Exo
dc3d281274 Load update state date with explicit timezone (#808) 2018-07-14 00:01:45 +02:00
Lonami Exo
051d56af88 Support clicking buttons known their data 2018-07-12 16:26:22 +02:00
Lonami Exo
22c8fd7378 Fix Updates object being dispatched to user handlers 2018-07-12 09:45:29 +02:00
Lonami Exo
38c65adf35 Set timezone info when reading datetimes 2018-07-12 00:30:57 +02:00
Lonami Exo
8b4c8d30e7 Fix events.MessageDeleted setting readonly properties 2018-07-11 11:34:20 +02:00
Lonami Exo
4f5c6f1006 Merge branch 'event-reusing' 2018-07-11 11:31:46 +02:00
Lonami Exo
e2ffa816dc Fix infinite recursion 2018-07-11 11:23:11 +02:00
Lonami Exo
1d0fd6801d Build events only once per update 2018-07-11 11:22:43 +02:00
Lonami Exo
81f31e09c8 Keep track of how many events for each type were added 2018-07-11 10:50:19 +02:00
Lonami Exo
e902304360 Expose silent parameter when sending messages 2018-07-11 10:16:21 +02:00
Lonami Exo
71309c886e Document usage of the TelegramClient with examples 2018-07-10 21:07:21 +02:00
Lonami Exo
a3d6baf408 Actually add callbacks registered through Button 2018-07-10 19:50:18 +02:00
Lonami Exo
f6c45dcc63 Support filtering events.CallbackQuery 2018-07-10 17:59:13 +02:00
Lonami Exo
ea07cf8d12 Add buttons parameter to client.edit_message 2018-07-10 17:59:13 +02:00
Lonami Exo
05e8e60291 Create events.CallbackQuery 2018-07-10 17:59:13 +02:00
Lonami Exo
8eecd9c226 Reuse code to get chat and sender 2018-07-10 17:59:13 +02:00
Lonami Exo
531a02a2a1 Support buttons when sending a file too 2018-07-10 17:59:13 +02:00
Lonami Exo
8c28be04bc Create a custom.Button class and support send_message(buttons=...) 2018-07-10 17:59:13 +02:00
Lonami Exo
a50d013ee6 Support interactively signing in as a bot 2018-07-10 17:59:13 +02:00
Lonami
ac5f8da50c
Fix update.pts may be None 2018-07-10 16:59:40 +02:00
josephbiko
e6981e7676 Remove empty except (#887) 2018-07-09 20:54:43 +02:00
Lonami Exo
4328663c78 Support timedelta as datetimes 2018-07-09 13:36:52 +02:00
Lonami Exo
1437b69829 Update to v1.0.4 2018-07-09 12:32:47 +02:00
Lonami Exo
1b22d0eb12 Add missing await 2018-07-08 23:44:56 +02:00
Lonami Exo
7b6e65a7a5 Re-export ConnectionHttp from the network package 2018-07-08 17:48:38 +02:00
Lonami
128053750d
Implement HTTP(S) mode (closes #112) (#883) 2018-07-08 17:45:49 +02:00
Lonami Exo
e0513e10df Remove debug print 2018-07-08 15:24:33 +02:00
Lonami Exo
3a9cce8720 Add missing async/await to events' documentation 2018-07-08 15:11:10 +02:00
Lonami Exo
d02cb84abe Fix end of sync with block warning on disconnect 2018-07-08 00:05:09 +02:00
Lonami Exo
54bffb30d8 Fix send_message('me', Message) 2018-07-08 00:05:09 +02:00
Lonami
8ca2e56aee
Fix ID autocast should not add the mark 2018-07-07 19:42:47 +02:00
Lonami Exo
61f9dc1cd7 Fix-up missing parenthesis from 066004a 2018-07-07 13:03:46 +02:00
Lonami Exo
066004acd1 Support chat_id autocast 2018-07-07 12:53:46 +02:00
Lonami Exo
cb3846cb7f Add client.get_peer_id 2018-07-07 12:45:50 +02:00
Lonami Exo
3b3b148a43 Revert add_mark parameter on utils.get_peer_id
And a fix for -1000 IDs that wasn't being accounted for.
2018-07-07 12:44:21 +02:00
Lonami Exo
5d4b8a283d Don't generate def resolve() for types
This would require nested resolving which could be quite
expensive. Instead there will just be a single level for
resolve() and it will belong in the requests.
2018-07-07 12:17:29 +02:00
Lonami Exo
bb4ed4019f Revert forward_messages requiring named from_peer arg 2018-07-07 12:14:50 +02:00
Lonami Exo
bd878acbde Support InputNotifyPeer autocast 2018-07-07 12:14:03 +02:00
Lonami Exo
dfda61a1b5 Correct thumb parameter documentation 2018-07-07 12:01:42 +02:00
Lonami Exo
393e1966c7 Avoid exceeding maximum container size
This issue would likely be triggered when automatically
merging multiple requests into a single one while having
their size exceed 1044456 bytes like SaveFilePartRequest.

This commit avoids such issue by keeping track of the
current size, and if it exceeds the limit, avoid merge.
2018-07-07 11:58:48 +02:00
Lonami Exo
33ce702ab9 Pre-pack outgoing TLMessage
This has several benefits:
- The message can be resent without re-calling bytes(),
  which for some requests may be expensive.
- Converting requests to bytes early lets us detect
  errors early, such as OverflowError on bad requests.
- Containers can't exceed 1044456 bytes so knowing their
  length is important. This can now be done in O(1).

But also several drawbacks:
- If the object is modified the bytes won't reflect this.
  This isn't an issue because it's only done for in msgs.
- Incoming messages can no longer be reconverted into
  bytes but this was never needed anyway.
2018-07-07 11:46:21 +02:00
Lonami Exo
b237947af1 Update to v1.0.3 2018-07-04 15:41:11 +02:00
Lonami Exo
44630542d0 Fix MessageAction not allowing access to media
This caused some issues with events.MessageEdited because
some MessageAction can trigger these edit updates such as
scoring in a game.
2018-07-03 14:13:44 +02:00
Lonami Exo
43afdb9d77 Fix-up 53fbfb2 for InputPeerChat or others 2018-07-03 14:05:42 +02:00