Commit Graph

671 Commits

Author SHA1 Message Date
Lonami Exo
7a7923b317 Fallback to MemorySession if sqlite3 is not available 2018-08-02 15:17:44 +02:00
Lonami Exo
328f737ef7 Support custom.MessageButton as buttons reply markup 2018-08-02 13:17:59 +02:00
Lonami Exo
80a5e709cb Support .download_media with bot API file_id 2018-08-01 13:40:07 +02:00
Lonami Exo
e359b428c3 Merge branch 'inlineresult' 2018-08-01 01:06:59 +02:00
Lonami Exo
7a2d7d98ad Implement client.inline_query() 2018-08-01 01:06:47 +02:00
Lonami Exo
76c7217000 Support downloading web documents 2018-08-01 00:37:25 +02:00
Lonami Exo
6d1bc227aa Support bot API file_id on send_file 2018-07-31 23:35:22 +02:00
Lonami Exo
f0a26d7c76 Implement global search (closes #920) 2018-07-29 23:16:22 +02:00
Lonami Exo
f2c8663266 Fix copy pasted docs and snake_case files 2018-07-28 11:28:02 +02:00
Lonami Exo
26f121060d Always support aggressive in iter_participants (#904) 2018-07-25 12:40:49 +02:00
Lonami Exo
6c51c35ccf Fix _iter_ids not expecting InputChannel 2018-07-24 18:20:34 +02:00
Lonami Exo
1c0d595205 Replace custom.Message creation with ._finish_init 2018-07-22 19:20:55 +02:00
Lonami Exo
e4963237dc Fix-up a332d29 should not be exported on invalid DC 2018-07-22 01:08:03 +02:00
Lonami Exo
a332d29c4c Fix-up 5a9a00e to handle exporting senders to the same DC 2018-07-22 00:40:39 +02:00
Lonami Exo
46b2d910d7 Fix logging of functools.partial() callbacks 2018-07-21 17:52:42 +02:00
Lonami Exo
3bdfd4b32c Make build_reply_markup public 2018-07-21 13:55:26 +02:00
Lonami Exo
7750c9ff2f Make sure to not add callbacks from buttons= twice 2018-07-21 13:24:32 +02:00
Lonami Exo
24758b82ec Don't make a request at all if it will trigger flood wait 2018-07-21 12:25:20 +02:00
Lonami Exo
a9cc35e604 Avoid triggering FileMigrateError when possible 2018-07-21 11:59:44 +02:00
Lonami Exo
5a9a00e7ae Assume exported auths last forever
This implies that export senders will NOT be deleted from
memory once all borrows are returned, thus their auth_key
remains as well. When borrowing them if they existed they
will be connect()ed if it's the first borrow.

This probably fixes #901.
2018-07-21 11:24:20 +02:00
Lonami Exo
2d7c8908eb Create events.InlineQuery 2018-07-15 11:31:24 +02:00
Lonami Exo
22c8fd7378 Fix Updates object being dispatched to user handlers 2018-07-12 09:45:29 +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
a3d6baf408 Actually add callbacks registered through Button 2018-07-10 19:50:18 +02:00
Lonami Exo
ea07cf8d12 Add buttons parameter to client.edit_message 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
e0513e10df Remove debug print 2018-07-08 15:24:33 +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 Exo
cb3846cb7f Add client.get_peer_id 2018-07-07 12:45:50 +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
Harry
dfcf414111 Fix hachoir don't close files by itself (#875) 2018-06-29 16:45:18 +02:00
Lonami Exo
baedd10110 Update to layer 82 2018-06-29 13:23:56 +02:00
Lonami Exo
3c2ff45b0b Support dispatching updates in a sequential order 2018-06-29 10:45:04 +02:00
Lonami Exo
0f737a86af Revert sign_in needing named code argument 2018-06-29 09:57:57 +02:00
Lonami Exo
dbca38c6f5 Allow iterating over messages in reverse 2018-06-28 21:15:29 +02:00
Lonami Exo
ac6dbb8a5c Fix is_connected accessing unexisting property 2018-06-28 16:04:12 +02:00
Lonami Exo
ac2b10f2a5 Stop using loop's time() function 2018-06-28 15:12:18 +02:00
Lonami Exo
491302bb32 Fix parallel downloads when using exported senders 2018-06-28 14:10:36 +02:00
Lonami Exo
a6782ac6ea Send getState upon successful reconnection 2018-06-27 19:40:32 +02:00
Lonami Exo
c0412e4410 Fix run_until_disconnected disconnect with telethon.sync 2018-06-27 19:39:47 +02:00
Inokenty
f014c040a3 Keyword arg instead positional for sign_in (#869) 2018-06-27 17:23:46 +02:00
Lonami Exo
a46a45d060 Don't disconnect on del if already disconnected/loop closed 2018-06-27 13:57:17 +02:00
Lonami Exo
72835dfb44 Update to v1.0 2018-06-27 13:41:20 +02:00
Lonami Exo
58aadce5ba Fix-up 2b090f8 not actually resaving new auth_keys 2018-06-27 10:15:59 +02:00
Lonami Exo
8c5bbdf7eb Check from_user client-side for PMs in iter_messages 2018-06-26 16:48:03 +02:00
Lonami Exo
09ea8ffe0b Fix send_file completely ignoring input parameters 2018-06-26 16:39:43 +02:00
Lonami Exo
2bd0c6c525 Support URLs on send_file 2018-06-26 16:39:22 +02:00
Lonami Exo
2b090f8888 Fix connect not saving different authkeys 2018-06-26 16:20:30 +02:00
Lonami Exo
9159e2a720 Remove report_errors/flood_sleep_threshold from the session 2018-06-26 16:09:16 +02:00
Lonami Exo
6152e33454 Fix sync run_until_disconnected not liking Ctrl+C 2018-06-26 15:48:38 +02:00
Lonami Exo
f6bfcad49e Don't close session file on _switch_dc disconnect 2018-06-26 13:37:34 +02:00
Lonami Exo
3556d5ed79 Fix-up 9971145 still accessing unexisting properties 2018-06-26 13:15:25 +02:00
Lonami Exo
9971145721 Assert properties exist on disconnect 2018-06-26 12:03:31 +02:00
Lonami Exo
32786d16fd Support using the client in with blocks 2018-06-26 11:26:01 +02:00
Lonami Exo
d4b508bf48 Fix __del__ with sync magic 2018-06-26 11:23:51 +02:00
Lonami Exo
75dc4809f5 Remove all deprecated methods 2018-06-26 11:10:11 +02:00
Lonami Exo
a43c6c2b68 Work around Python 3.5.2 bug causing 100% CPU load on script's end 2018-06-26 11:10:11 +02:00
Lonami Exo
044e6e8a85 Await updates task to finish upon disconnect 2018-06-26 11:10:11 +02:00
Lonami Exo
9c6d2894fc Allow start when the loop is not running 2018-06-25 13:42:29 +02:00
Lonami Exo
db5cb74bdd Allow run_until_disconnected when the loop is running 2018-06-25 13:32:31 +02:00
Lonami Exo
d4479a0a4e Save the session file less often 2018-06-24 12:21:58 +02:00
Lonami Exo
51da48ddd2 Support custom parse_mode to use MessageEntityMentionName 2018-06-22 16:18:23 +02:00
Lonami Exo
3d3698562b Cleanly handle KeyboardInterrupt in run_until_disconnected 2018-06-22 13:26:24 +02:00
Lonami Exo
3973755333 Support .name attr in utils.is_type/client.upload_file
This means open()'ed files will have their name used properly,
and that you can set b.name = 'somename.jpg' to io.BytesIO()
objects to have them uploaded as images.
2018-06-21 16:31:03 +02:00
Lonami Exo
d8af64e3b9 Clarify/fix get[_input]_entity docstrings 2018-06-21 11:08:14 +02:00
Lonami Exo
cfa5cd0db2 Fix is_user_authorized always returning True 2018-06-21 09:32:09 +02:00
Lonami Exo
d6818f25f5 Fix rare iter_dialogs infinite loop 2018-06-20 21:12:47 +02:00
Lonami Exo
9c0a22ddd7 Fix Python 3.5 compatibility 2018-06-20 20:18:16 +02:00
Lonami Exo
a1477a84bf Update in-memory updates.State 2018-06-20 19:58:01 +02:00
Lonami Exo
a0eb824e87 Support ignore_migrated in iter_dialogs 2018-06-20 12:03:42 +02:00
Lonami Exo
c85ba4accc Revisit documentation, cross-references and unnecessary indents 2018-06-20 11:06:03 +02:00
Lonami Exo
4e9a84c3b5 Remove underscore from module names 2018-06-18 21:02:42 +02:00
Lonami Exo
262018959f Process entities from sent requests/updates 2018-06-18 20:44:20 +02:00
Lonami Exo
463847ad50 Revisit and remove a few TODOs 2018-06-18 18:46:06 +02:00
Lonami Exo
ebfe8ebf40 Configurable per-client request/connection retries 2018-06-18 18:13:00 +02:00
Lonami Exo
51d8ea0fa8 Shield disconnected Future in the MTProtoSender instead 2018-06-18 15:55:24 +02:00
Lonami Exo
efc48ee3b0 Shield self.disconnected and log RpcCallFail 2018-06-18 14:28:30 +02:00
Lonami Exo
3c1d7d2da2 Fix MessageEmpty when searching for messages 2018-06-18 13:48:50 +02:00
Lonami Exo
374f5e2aab Periodically send ping/getState 2018-06-18 13:22:25 +02:00
Dan Elkouby
d5b349e031 Implement a mechanism to notify of connection failures (#852) 2018-06-17 19:29:41 +02:00
Lonami Exo
d9d586171f Fix MTProtoSender should not send content-related queries 2018-06-17 16:23:22 +02:00
Lonami Exo
aaa7ec757b Support start() retrying on PasswordHashInvalidError 2018-06-17 14:07:45 +02:00
Lonami Exo
b65cbd8647 Validate to_id when iterating over messages by ID 2018-06-17 11:57:11 +02:00
Lonami Exo
226c35ff8f Pump up default timeout from 5 to 10s 2018-06-17 11:46:56 +02:00
Lonami Exo
7cfecfaf21 Support pathlib.Path on download/upload 2018-06-16 17:01:20 +02:00
Lonami Exo
cbd5594dba Use the correct clock time when sleeping on iter_messages 2018-06-15 17:09:16 +02:00
Lonami Exo
509fba8bcc Fix-up isinstance/is_user_authorized from 06cdf1f 2018-06-15 13:01:16 +02:00
Lonami Exo
31c94ec184 Add a lock for resolving events 2018-06-15 10:11:43 +02:00
Lonami Exo
091b03c635 Use create_task instead ensure_future 2018-06-14 23:33:56 +02:00
Lonami Exo
06cdf1fdb0 Raise on phone/network migrate if authorized 2018-06-14 23:16:00 +02:00
Lonami Exo
c788e17c22 Fix _handle_update not expanding Updates 2018-06-14 22:51:57 +02:00
Lonami Exo
0f14f3b16a Support custom event loops 2018-06-14 19:35:12 +02:00
Lonami Exo
908dfa148b Revisit codebase to add missing async/await 2018-06-14 17:09:20 +02:00
Lonami Exo
3ce8b17193 Dispatch updates to event handlers 2018-06-13 16:20:15 +02:00
Lonami Exo
a91109c9fa Retry send_code_request on AuthRestartError 2018-06-13 10:55:37 +02:00
Lonami Exo
3324090c96 Fix non-asyncio sleep 2018-06-13 09:59:30 +02:00
Lonami Exo
3f16c92eb3 Subclass TLRequest for content-related objects 2018-06-12 20:14:21 +02:00
Lonami Exo
f9cd220ddd Implement _get_exported_sender 2018-06-11 20:05:10 +02:00
Lonami Exo
f86f52d960 Fix async_generator's and missing awaits 2018-06-10 22:00:55 +02:00
Lonami Exo
8be6adeab4 Make use of the async_generator module 2018-06-10 21:50:28 +02:00
Lonami Exo
15ef302428 Implement _switch_dc/fix missing first request 2018-06-10 21:30:31 +02:00
Lonami Exo
1bde72d375 Make the TelegramClient aggregate all client methods 2018-06-10 19:05:36 +02:00
Lonami Exo
fb8b052754 Separate update requests from the TelegramClient 2018-06-10 13:58:21 +02:00
Lonami Exo
ac2e59b472 Separate auth requests from the TelegramClient 2018-06-10 12:57:36 +02:00
Lonami Exo
4ff0756ffc Separate download requests from the TelegramClient 2018-06-10 12:04:23 +02:00
Lonami Exo
317b7053a0 Separate parse message methods from uploads 2018-06-10 11:33:20 +02:00
Lonami Exo
83a024656c Rename client.files as client.uploads 2018-06-09 22:14:51 +02:00
Lonami Exo
ad29f2f5b7 Separate chat requests from the TelegramClient 2018-06-09 22:13:18 +02:00
Lonami Exo
1e91e5a83c Separate dialogs methods from the TelegramClient 2018-06-09 22:09:02 +02:00
Lonami Exo
4bd20f1ce2 Separate file and message methods from TelegramClient 2018-06-09 22:05:06 +02:00
Lonami Exo
bb9b9796e0 Separate user methods from the base client 2018-06-09 21:22:54 +02:00
Lonami Exo
4b147f0153 Move clients to a new package 2018-06-09 21:11:35 +02:00