Commit Graph

1208 Commits

Author SHA1 Message Date
Lonami Exo
fe3172b2c9 Fix accept TOS must be called after sign up (#824) 2018-06-03 16:47:19 +02:00
Lonami Exo
997f2b62ce Fix EventCommon/custom.Message conflicting properties 2018-06-03 16:41:13 +02:00
Lonami Exo
8c8a0153ef Revert 9db9d1e's count and fix typo 2018-06-03 15:20:52 +02:00
Lonami Exo
ab9d10c569 Update to v0.19.1 2018-06-03 14:20:50 +02:00
Lonami Exo
c2b8f8a1d6 Support editing media 2018-06-03 13:49:19 +02:00
Lonami Exo
2fb5215f5f Fix parsers misbehaving with None text 2018-06-03 13:48:43 +02:00
Lonami Exo
92b6e857a4 Separate file_to_media logic from send_file 2018-06-03 13:37:18 +02:00
Lonami Exo
e93b8f2b13 Update to layer 80 and accept TOS on sign_up (#824) 2018-06-03 13:26:51 +02:00
Lonami Exo
b2ed6caff4 Fix setattr for events.NewMessage/custom.Message 2018-06-03 13:00:07 +02:00
Lonami Exo
0a3151175d Fix infinite recursion on setattr custom.Message 2018-06-03 12:29:30 +02:00
Lonami Exo
81c61a0a2e Handle MessagesNotModified on iter_messages 2018-06-03 12:03:02 +02:00
Lonami Exo
8d7c7a19c0 Add some setters for custom.Message 2018-06-03 11:53:18 +02:00
Lonami Exo
8b16023566 Allow setting a per-client default parse mode 2018-06-03 11:29:48 +02:00
Lonami Exo
f7222407de Document custom.Message 2018-06-02 12:52:38 +02:00
Lonami Exo
5c76af34aa Fix copy-paste typo 2018-06-02 12:38:47 +02:00
Lonami Exo
6dcd0911a7 Move events.NewMessage properties to custom.Message 2018-06-02 12:30:25 +02:00
Lonami Exo
97b0a0610e Support get_messages(ids=) without entity 2018-06-02 12:09:21 +02:00
Lonami Exo
e2ce55871e Replace custom.Message's class on creation 2018-06-01 21:20:34 +02:00
Lonami Exo
9db9d1ed5c Implement __bytes__ and use count instead sum 2018-05-31 22:39:32 +02:00
Lonami Exo
2191fbf30b Fix custom.Message.click not having buttons 2018-05-31 14:10:19 +02:00
Lonami Exo
a1c511429e Port NewMessage.edit/delete to custom.Message 2018-05-31 14:01:42 +02:00
Lonami Exo
66d5443fcd Add custom.Message.fwd_from_entity 2018-05-31 13:56:33 +02:00
Lonami Exo
58f621ba82 Make custom.Message more consistent with previous patches 2018-05-31 13:50:08 +02:00
Lonami Exo
9e4854fcce Use custom.Message in events 2018-05-31 13:30:22 +02:00
Lonami Exo
b241d80958 Return custom.Message from the TelegramClient 2018-05-31 12:52:03 +02:00
Lonami Exo
5aed494aac Fix custom.Message special methods 2018-05-31 12:50:08 +02:00
Lonami Exo
192b7af136 Lazily load user/input user on Message 2018-05-31 12:24:25 +02:00
Lonami Exo
aa70436441 Add a custom Message class 2018-05-31 10:32:32 +02:00
Lonami Exo
68bb8e8b91 Add is_user/group/channel and title to Dialog 2018-05-30 19:20:27 +02:00
Lonami Exo
ae87d452c8 Clean-up docs and merge some imports 2018-05-30 18:55:01 +02:00
Lonami Exo
780c66c619 Allow getting messages by their ID 2018-05-28 19:33:23 +02:00
Lonami Exo
6c20f8a2c7 Set is private/group=True for messages deleted out of channels 2018-05-28 18:27:44 +02:00
Lonami Exo
a1b22e0911 Support incoming=False to indicate outgoing=True 2018-05-28 18:25:01 +02:00
ferferga
2c9d3d2fed Better handling of video notes (#803) 2018-05-24 12:28:10 +02:00
Lonami Exo
03f0044ef8 Change default iter/get messages limit
And fix-up previous commit.
2018-05-24 10:40:44 +02:00
Lonami Exo
a076688fdc Avoid sending min_id/max_id params in iter_messages 2018-05-24 10:19:48 +02:00
Lonami Exo
fac6b2348b Fix pts may be 0 with no workers set (#808) 2018-05-22 10:39:40 +02:00
Lonami Exo
b667bb0c1a Fix some chat IDs start with 1000 2018-05-20 12:31:57 +02:00
Lonami Exo
129f5bf1f8 Add an additional check to avoid duplicate iter_messages 2018-05-17 12:08:52 +02:00
Lonami Exo
cffef411b2 Enhance documentation 2018-05-17 12:00:22 +02:00
Lonami Exo
a8be4bb615 Fix catch_up may use None state 2018-05-17 10:42:20 +02:00
Lonami Exo
89182ea010 Fix iter_messages + from_user not working without filter 2018-05-17 10:17:22 +02:00
Lonami Exo
208adc93a6 Stop using without rowid altogether
While something nice to have if supported, it just causes problems
for people trying to use the same session accross systems having
different sqlite versions. See https://t.me/TelethonChat/36771.
2018-05-14 17:41:47 +02:00
Lonami Exo
c010683685 Fix using *args on phone migrate 2018-05-13 17:15:25 +02:00
Lonami Exo
32b7e9e27a Whitelist generator's mismatching ID and ya username 2018-05-12 16:12:42 +02:00
Lonami Exo
e3c6676795 Fix short special usernames not being valid (like vote) 2018-05-11 10:09:38 +02:00
Lonami Exo
ee51aa7073 Fix lost requests on disconnect need_confirmation.clear
The pending acks shouldn't be cleared, in case of a reconnection
these would be pretty common. E.g. disconnect(), connect(),
invoke, repeat.
2018-05-10 16:45:55 +02:00
Lonami Exo
eb22bce2d9 Add missing connect abstractmethod 2018-05-10 16:16:23 +02:00
Lonami Exo
ba4b7ce881 Make the Connection a proper ABC (#509) 2018-05-10 14:22:19 +02:00
Lonami Exo
dd954b8fbd Avoid receive busy wait when two threads receive items 2018-05-10 09:44:25 +02:00
Lonami Exo
ef509d13c7 Move InvokeAfterMsg to TLMessage to cleanly confirm results 2018-05-09 16:18:42 +02:00
Lonami Exo
e2e7e631b5 Stop using *args when invoking many requests at once 2018-05-09 10:19:45 +02:00
Lonami Exo
e200acbca8 Allow sending ordered MessageContainer 2018-05-09 09:46:07 +02:00
Lonami Exo
bda7eb0ef1 Update to v0.19 2018-05-07 21:30:12 +02:00
Lonami Exo
392508c78d Add voice/video note parameters to send_file 2018-05-07 19:53:32 +02:00
Lonami Exo
37436bdeee First attempt at updates catch_up for private chats/groups 2018-05-07 18:02:15 +02:00
Lonami Exo
6652fe276c Remove broken packet length check 2018-05-07 17:05:27 +02:00
Lonami Exo
f06b9b68d5 Fix race condition causing broken responses 2018-05-07 17:01:04 +02:00
Lonami Exo
2922e8df11 Fix still broken log for broken packets 2018-05-07 16:46:58 +02:00
Lonami Exo
6cd96389c0 Call disconnect on ConnectionResetError hoping a reconnection
Maybe self._reconnect() had no effect unless a clean disconnect
was done, and so retrying would be mostly useless. Just a guess.
2018-05-06 18:59:53 +02:00
Lonami Exo
f442e01560 Documentation enhancements 2018-05-06 13:03:30 +02:00
Lonami Exo
2045e00563 Stop manually constructing InputFileLocation 2018-05-06 11:46:04 +02:00
Lonami Exo
ee1e4e18f6 Clean-up download_profile_photo and add missing cases 2018-05-06 11:41:42 +02:00
Lonami Exo
d6935355ae Fix two tiny typos 2018-04-28 13:42:36 +02:00
Lonami Exo
ce7e5abb58 Support filtering events.Raw by update type 2018-04-28 13:37:19 +02:00
Lonami Exo
5c6ac18a52 Attach original_update to all events 2018-04-28 12:58:41 +02:00
Lonami Exo
08dbc42718 Update to layer 76 2018-04-28 11:49:43 +02:00
Lonami Exo
dc273ab6bc Add utils.get_input_location 2018-04-27 21:11:13 +02:00
Lonami Exo
f16289cf93 Support download_file with None path to return bytes 2018-04-27 21:11:13 +02:00
Lonami Exo
b71511cd63 Fix saving update state in the SqliteSession 2018-04-27 21:11:13 +02:00
Lonami Exo
2a00bcaa12 Persist updates.State upon disconnection 2018-04-25 13:37:29 +02:00
Lonami Exo
e2a0de1913 Don't retry forever on TcpClient.connect() 2018-04-25 10:06:11 +02:00
Lonami Exo
387a255221 Faster iter_messages by sleeping only as much as needed 2018-04-25 09:51:50 +02:00
Lonami Exo
ea404c5477 Add update_state table to persist pts and such 2018-04-23 21:16:09 +02:00
Lonami Exo
ab91bc2829 Add missing InputPhoto/Document -> InputMedia autocast 2018-04-23 15:33:44 +02:00
Lonami Exo
f31ca142a3 Support autocast to InputMessage 2018-04-23 11:05:38 +02:00
Lonami Exo
6ecef42ec7 Add search/filter/from_user parameters to iter_messages 2018-04-22 16:30:14 +02:00
Lonami Exo
544651caa7 Retry on RpcCallFailError 2018-04-22 16:30:00 +02:00
Lonami Exo
5dc43276bb Add missing caption when sending Message with media 2018-04-20 09:44:33 +02:00
Lonami Exo
1c2e9d2f27 Fix reply_to didn't override Message's reply on sending them 2018-04-20 09:36:34 +02:00
Lonami Exo
b0dda777fe Support omitting the entity on client.edit_message 2018-04-18 10:27:44 +02:00
Yifei Kong
03bebfb600 Fix tiny docstring typo (#771) 2018-04-17 13:01:23 +02:00
Lonami Exo
6893359f9d Fix tiny error in a docstring for #764 2018-04-15 16:21:15 +02:00
Lonami Exo
f9b9fa6e70 Update to v0.18.3 2018-04-15 15:41:11 +02:00
Lonami
ffdfa8f262
Merge pull request #766 from LonamiWebs/tidygenerator
Tidy up the telethon-generator package
2018-04-15 13:21:26 +02:00
Lonami Exo
3b7c4fe278 Further TLObject generator clean-up
Split everything into several functions, reused some more
common code (like accessing the "real" arguments instead
constantly filtering) and more, like using classmethods
instead staticmethods and then hardcoding the class name.
2018-04-14 20:28:25 +02:00
Jon Besga
0017ce30e6 Set client._authorized after log_out() (#765) 2018-04-14 19:15:33 +02:00
Lonami Exo
200d3c0360 Clean-up unused methods and reuse more common utils 2018-04-14 17:22:39 +02:00
Lonami Exo
ace715e059 Don't log broken packets as individual bytes 2018-04-14 15:02:27 +02:00
Lonami Exo
75d37a3870 Handle web pages on .download_media 2018-04-14 13:07:50 +02:00
Lonami Exo
88597f0da8 Don't get full channel on iter_participants unless necessary 2018-04-14 12:08:50 +02:00
Lonami Exo
4da7df6349 Several documentation fixes and additions 2018-04-14 12:03:08 +02:00
Lonami Exo
a13863a4fb Re-export events.Raw (removed on b7c3f80) 2018-04-13 17:36:23 +02:00
Lonami Exo
1316e07dca Add missing InputPeerSelf case to .get_entity() 2018-04-13 13:24:37 +02:00
Lonami Exo
17a2946311 Fix get_input_peer allow_self for custom.Dialog 2018-04-13 13:08:29 +02:00
vegeta1k95
3bf259d6b3 Make TLObjects picklable (#752) 2018-04-12 18:02:46 +02:00
vegeta1k95
bd1b0ecdb4 Make RPCError class picklable (#751) 2018-04-08 16:48:55 +02:00
Lonami Exo
414fec91f1 Stop using input version on events to just get the ID 2018-04-08 15:55:10 +02:00
Lonami Exo
93b5909be5 Add chat_id-like convenience properties to the events 2018-04-08 14:24:01 +02:00
Jeff
259bb6ace1 Several documentation fixes/additions (#750) 2018-04-08 14:15:26 +02:00
Lonami Exo
8e01946957 Fix .start() failing on some terminals 2018-04-08 11:47:18 +02:00
Lonami Exo
5fd6155168 Fix remove_event_handler's loop 2018-04-08 11:22:59 +02:00
Lonami Exo
e69c186782 Support more filter types for convenience (#745) 2018-04-07 12:31:30 +02:00
Lonami Exo
3b2d065d35 Simplify .get_input_entity code flow (since 591e34b) 2018-04-06 19:21:02 +02:00
Lonami Exo
0cd44b245c Allow auto-casting custom.Dialog into input_entity 2018-04-06 19:11:31 +02:00
Lonami Exo
baa6976a0b Fix broken links, add more examples and a new section 2018-04-06 19:00:21 +02:00
Lonami Exo
b7c3f80679 Split events into separate files 2018-04-05 20:14:22 +02:00
Lonami Exo
f9f49a893b Return a single message from client.forward on non-list inputs 2018-04-04 20:58:58 +02:00
Lonami Exo
591e34b491 Change TypeError with ValueError, don't call .get_dialogs()
This closes #735 and #736 since now it can be properly handled
from user code, and behave more correctly depending on the situation.

Also the errors provide more information on how to get around it.
2018-04-04 13:35:51 +02:00
Lonami Exo
07a8a73e3e Support callable parse_mode's
This allows to more easily plug in custom parse methods.
2018-04-03 14:23:05 +02:00
Lonami Exo
eabaa3854a Replace offset with match.start() to allow custom regex 2018-04-03 13:47:40 +02:00
Tanuj
a1448f3da8 Clearer variable names in get_input_entity (#738) 2018-04-03 13:05:01 +02:00
Lonami Exo
7bc021bba4 Update to layer 75 (again) 2018-03-30 20:28:07 +02:00
Lonami Exo
500792975e Handle AUTH_KEY_DUPLICATED on connection 2018-03-30 12:18:18 +02:00
Lonami Exo
2b9babb30f Handle GzipPacked lost requests & possibly fix reading normal
Reading normal "lost" requests didn't .seek(-4) to read the TLObject
again. Now it has been slightly refactored to seek back always and
only seek forward when needed (e.g. rpc error).
2018-03-30 11:50:41 +02:00
Lonami Exo
dede5520dd Rename .entities -> ._entities from 7e9d19d to avoid collision 2018-03-29 00:56:05 +02:00
Lonami Exo
395e702586 Make py:obj default Sphinx's role 2018-03-28 16:03:47 +02:00
Lonami Exo
dcb7820c5f Add a new events.MessageRead 2018-03-28 15:52:55 +02:00
Lonami Exo
1fdf976c04 Update to v0.18.2 2018-03-27 18:02:55 +02:00
Kyle2142
6c9becb1ed Add edit_2fa function (#725) 2018-03-27 17:35:33 +02:00
Lonami Exo
302a823c88 Fix invalid access to .participants on chat forbidden result 2018-03-27 17:15:22 +02:00
Lonami Exo
7b94530bfc Move me/self check on get_input_entity to the beginning
It would otherwise fail since the addition of getting entity
by exact name if someone had 'me' or 'self' as their name.
2018-03-27 11:29:47 +02:00
Lonami Exo
8d652c35a1 Add missing Photo/Document cases to get_input_media 2018-03-27 11:22:31 +02:00
Lonami Exo
ae2abd2ba9 Add __str__/.stringify() to tl.custom for completeness 2018-03-27 11:08:40 +02:00
Lonami Exo
1c9dc8dc63 Fix getting ID on custom Dialog class from dce0fd9 2018-03-24 18:44:13 +01:00
Lonami Exo
790b0d2d23 Guess entity type on positive IDs in events and avoid some RPCs
Now specifying a single positive integer ID will add all the types
to the white/blacklist so it can be "guessed". Explicit peers will
always be only that type, and an RPC is avoided  (since it was not
needed to begin with).
2018-03-24 18:34:07 +01:00
Lonami Exo
13e59983af Slightly change docs for events (#668) 2018-03-24 12:42:19 +01:00
Lonami Exo
898e550335 Except the right type for get_input_peer (closes #722) 2018-03-24 12:09:33 +01:00
Lonami Exo
43c6896481 Add a custom role for TL references and make use of it 2018-03-23 21:42:17 +01:00
Lonami Exo
c6d821910e Mention that codes can expire immediately 2018-03-22 19:20:35 +01:00
Lonami Exo
021cb21686 Replace custom Box class with a single-item list for args by ref 2018-03-22 19:13:42 +01:00
Lonami Exo
33e908de42 Fix markdown regex not supporting [] inside URLs 2018-03-22 19:02:08 +01:00
Lonami Exo
dce0fd9e03 Add missing documentation for telethon.tl.custom and crosslinks 2018-03-22 19:02:08 +01:00
Jeff
95f368201e Fix ChatAction not handling all pin events (#715) 2018-03-21 10:01:14 +01:00
Lonami Exo
f2407409b3 Fix send_file(force_document=True) for albums (closes #713) 2018-03-21 09:46:57 +01:00
Lonami Exo
3550974b71 Fix documentation for events
Changing the .__name__ of a class will make it not show in the
generated documentation, so instead we need to use a different
variable.
2018-03-21 09:17:56 +01:00
Lonami Exo
89ae0cb164 Make readthedocs build run without warnings 2018-03-21 08:55:13 +01:00
Lonami Exo
987cf41ec6 Higher timeout and log them as warning if any data was received
This might be the cause for  "number of retries reached 0" so
more specific logging calls might be useful. If while reading
a response it times out but  some data had already been read,
said data will be lost.

The sequence of events that triggered reaching 0 retries was:
- Sending requests with IDs XYZ
- socket.timeout while reading
- Items timed out. Retrying
- Processing RPC result
- Received response for XYZ
- Lost request with ID XYZ
2018-03-18 20:08:00 +01:00
Alex Root Junior
986ddbe600 Fix forwarding messages to channels (#705) 2018-03-18 17:23:10 +01:00
Lonami Exo
d379b26339 Fix assignement to wrong variable on ChatAction 2018-03-18 10:24:48 +01:00
Lonami Exo
7825994393 Update to v0.18.1 2018-03-17 17:38:46 +01:00
Lonami Exo
32fd64d655 Remove SQLAlchemy session 2018-03-17 17:38:16 +01:00
Lonami Exo
dc07d65075 Add remove_event_handler and list_event_handlers 2018-03-17 17:08:11 +01:00
Lonami Exo
36b09a9459 .download_file's file is not optional 2018-03-16 09:57:37 +01:00
Lonami Exo
d6c051fd52 Add __str__ and .stringify() to events 2018-03-16 09:54:16 +01:00
Lonami Exo
b20aa0ccc9 Stopping workers should not clear their count (may fix #686) 2018-03-15 10:30:05 +01:00
Lonami Exo
1e3120b0b6 Bring back report_errors to the constructor 2018-03-15 10:22:21 +01:00
Lonami Exo
3b42bc9991 Slice albums larger than 10 items and allow mixing docs 2018-03-15 10:17:45 +01:00
Lonami Exo
d7ef0f5e09 Stop sending gifs as images
This is often not the case, most gifs are animated and when
sent as images inside albums they lose the animation.
2018-03-15 10:13:57 +01:00
Lonami Exo
45b7318f08 Fix Telegram only recognises 3 image filetypes 2018-03-15 09:52:45 +01:00
Lonami Exo
48869f0f4e Fix MessageEdited ignoring NewMessage constructor arguments
These include outgoing/incoming and pattern which are now handled.
2018-03-14 21:09:51 +01:00
Lonami Exo
d5bc3c1a6c Fix misleading documentation regarding report_errors 2018-03-14 21:05:50 +01:00
Lonami Exo
1ff5826c26 Call .get_dialogs only once on entity not found 2018-03-14 21:01:00 +01:00
Lonami Exo
8ae12fbb70 Return the entire entity from the helper events._get_entity too 2018-03-14 10:32:59 +01:00
Lonami Exo
7e9d19d727 Add known entities to all updates and use them in the events
This should reduce the amount of API calls made when getting the
full sender/chat on events (mostly on channels, where Telegram
seems to always send Updates instead only a normal Update).
2018-03-14 10:28:21 +01:00
Lonami Exo
fd309f0407 Add filter parameter to iter_participants and fix search for chats 2018-03-13 13:15:02 +01:00
Lonami Exo
a134336536 Fix ResolveUsernameRequest may return ChannelForbidden 2018-03-13 12:44:24 +01:00
Lonami Exo
751461f0f5 Modify iter_participants to also include .participant info 2018-03-12 10:33:51 +01:00
Lonami Exo
657c771fa0 Fix incorrect participant count on some channels 2018-03-12 09:52:16 +01:00
Lonami Exo
8b1cc4c8cb Better handle pinned dialogs and limit on .get_dialogs() 2018-03-11 09:55:31 +01:00
Lonami Exo
a596f88497 Fix wrong super() args for events.MessageDeleted (fix #675) 2018-03-11 09:48:48 +01:00
Lonami Exo
055aa7fe43 Fix MessageService not handled on .delete_messages (closes #681) 2018-03-11 09:43:55 +01:00
Lonami Exo
70ef93a62e Stop treating image/webp as images as Telegram throws error 2018-03-11 09:38:52 +01:00
Lonami Exo
e088fc3a4e Add extra safety checks when getting peer ID 2018-03-10 12:13:17 +01:00
Lonami Exo
2fb42772c6 Add .video_note and .gif convenience properties to NewMessage 2018-03-08 20:21:56 +01:00
Lonami Exo
cf650e061e Avoid editing events.NewMessage that are forwards 2018-03-08 20:18:10 +01:00
Lonami Exo
9d46bb35c8 Rename and reorder some params in Draft for consistency (#673) 2018-03-08 13:05:40 +01:00
Lonami Exo
8cefb22e14 Add .text and .raw_text properties to the Draft class (#673) 2018-03-08 12:56:20 +01:00
Lonami Exo
6e6d40be18 Implement Draft.send() (closes #673) 2018-03-08 12:37:06 +01:00
Lonami Exo
3d49f740df Use the new client.iter_dialogs() in client.get_input_entity() 2018-03-08 11:48:59 +01:00
Lonami Exo
5673866553 Create client.iter_ versions for all client.get_ methods
While doing so, the client.iter_drafts method has been simplified
as it made some unnecessary calls.

client.get_message_history has been shortened to client.get_messages,
and fixes a bug where the limit being zero made it return a tuple.

client.iter_messages also uses a local dictionary for entities so
it should become less big in memory (and possibly faster).

client.get_participants would fail with user entities, returning
only their input version.
2018-03-08 11:44:13 +01:00
Lonami Exo
09f0f86f1e Add convenience NewMessage attrs to get media of specific types 2018-03-08 10:30:49 +01:00
Lonami Exo
841aed13da Fix tuple/ternary operator fail on SQLAlchemy session (#671) 2018-03-08 10:16:46 +01:00
Lonami Exo
3a3ae75b46 Fix-up bot API style IDs not working on .get_input_entity 2018-03-08 10:12:43 +01:00
Lonami Exo
0f34a9b333 Fix .get_input_entity error message always showing None 2018-03-08 10:08:26 +01:00
Lonami Exo
ce0dee63b1 Support getting any entity by just their positive ID 2018-03-08 10:05:40 +01:00
Lonami Exo
d3d190f36e Fix-up previous commit overriding .action_message with None 2018-03-07 17:57:54 +01:00
Lonami Exo
801018fa9b Add respond, reply and delete methods to events.ChatAction
Also introduces the new .action_message member.
2018-03-07 17:51:59 +01:00
Lonami Exo
dc99d119c3 Fix events.MessageDeleted always failing due to extra "self." 2018-03-07 17:31:21 +01:00
Lonami Exo
fca4904d0f Add more logging calls when confirming a request 2018-03-07 11:30:03 +01:00
Lonami Exo
d0bdb7ea3f Lower message severity when retrying invoke the first time 2018-03-07 11:13:55 +01:00
Lonami Exo
dd6802e032 Support PhotoSize in .download_media (#669)
This simplifies downloading thumbnails (and any other PhotoSize).
2018-03-07 11:45:37 +01:00
Lonami Exo
e3adec5ea9 Fix caption being None
This would later be an empty string with some modifications that
were removed upon upgrading to layer 75, which changed where the
captions are used and their naming.
2018-03-07 09:09:05 +01:00
Lonami Exo
7201482ebd Support limit=0 on .get_participants to fetch count only 2018-03-06 12:24:37 +01:00
Lonami Exo
4f880dcd56 Replace BLOB with LargeBinary in sqlalchemy.py (closes #670) 2018-03-06 12:09:37 +01:00
Lonami Exo
fe627d1970 Update to v0.18 2018-03-04 12:03:09 +01:00
Lonami Exo
82c034dc56 Add forward_to on events.NewMessage 2018-03-04 00:32:26 +01:00
Lonami Exo
3a13f5f02f Implement a forward_messages convenience method 2018-03-04 00:27:21 +01:00
Lonami Exo
363e751f48 Fix UserList not being considered a list 2018-03-04 00:23:13 +01:00
Lonami Exo
4de811b8cb Expose the client on events as a public property 2018-03-03 23:55:35 +01:00
Lonami Exo
458d220af9 Fix users not being set for some events.ChatAction and properties 2018-03-03 23:41:27 +01:00
Lonami Exo
1c8bf44713 Add input user versions to events.ChatAction 2018-03-03 23:31:06 +01:00
Lonami Exo
c40a3ca77c Split MessageChanged into MessageEdited and MessageDeleted 2018-03-03 23:23:14 +01:00
Lonami Exo
854c42b7ef Add a file= parameter to client.send_message() 2018-03-03 23:12:05 +01:00
Lonami Exo
0f72aa8f94 Fix set union 2018-03-03 17:08:49 +01:00
Lonami Exo
96a1f580a4 Remove useless if condition on the memory session 2018-03-03 17:01:06 +01:00
Lonami Exo
81f8b7f76e Add back _entity_values_to_row 2018-03-03 16:48:57 +01:00
Lonami Exo
57f50889b0 Fix non-aggressive get_participants and inverted condition 2018-03-03 15:12:48 +01:00
Lonami Exo
0e0e7f1c9e Avoid unnecessary "or 0" in the session classes 2018-03-03 14:59:30 +01:00
Lonami Exo
6060b3430c Fix sqlite session clone causing integrity error
Triggered on migrations, the dc id would be None.
2018-03-03 14:02:48 +01:00
Lonami Exo
67a782a6d7 Fix wrong peer type being used when not found in the session 2018-03-03 12:22:02 +01:00
Lonami Exo
a9c83250a1 Small clean-up of the session classes 2018-03-03 12:51:35 +01:00
Lonami Exo
1e420f7f91 Document the new abstract session better 2018-03-03 12:13:42 +01:00
Lonami
30f7a49263
Abstract Session class (merge #657 from tulir/sessions) 2018-03-03 11:33:47 +01:00
Lonami Exo
74bffd2ae3 Support multiple captions when sending albums 2018-03-02 21:33:49 +01:00
Lonami Exo
2e31a686e8 Upgrade to layer 75
Captions are now "messages" and also support message entities.
2018-03-02 21:28:33 +01:00
Tulir Asokan
290afd85fc Fix AlchemySession session table updating 2018-03-02 21:58:16 +02:00
Tulir Asokan
47cdcda9e2 Move device info out of Session 2018-03-02 21:05:09 +02:00
Tulir Asokan
5e88b21aa9 Use single quotes 2018-03-02 20:42:51 +02:00
Tulir Asokan
f805914c80 Handle SQLAlchemy import errors 2018-03-02 20:40:03 +02:00
Tulir Asokan
c1a8896faa Fix SQLAlchemy implementation 2018-03-02 20:14:11 +02:00
Tulir Asokan
dc2229fdba Move salt and ID to base session and remove unused imports 2018-03-02 18:39:04 +02:00
Lonami Exo
a7f98fd3cc Ignore bad file descriptor while closing 2018-03-02 17:26:42 +01:00
Tulir Asokan
e1d7cc541f Add setters for non-persistent values that apps might change 2018-03-02 18:23:18 +02:00
Tulir Asokan
03d4ab3765 Fix create_engine check 2018-03-02 13:25:40 +02:00
Tulir Asokan
07c2fc50ec Add SQLAlchemy-based session 2018-03-02 13:22:30 +02:00
Tulir Asokan
118d9b10e8 Add more abstraction 2018-03-02 13:20:11 +02:00
Tulir Asokan
d9a73744a4 Remove old sqlite session variables and clone code 2018-03-02 12:36:39 +02:00
Tulir Asokan
df3faaeb7f Fix abstract Session method ordering 2018-03-02 11:11:59 +02:00
Lonami Exo
4c7224e56a Fix n might be None when stopping workers 2018-03-02 10:10:59 +01:00
Tulir Asokan
4c64d53e71 Move non-persistent stuff to base Session class 2018-03-02 11:10:11 +02:00
Tulir Asokan
c5e6f7e265 Split Session into three parts and make a module for sessions 2018-03-01 23:40:28 +02:00
Lonami Exo
f09ab6c6b6 Fix-up 771c573 to properly stop background update workers
The "special" StopIteration object didn't actually make any sense.
Instead looping forever, workers now loop while there are workers,
so that they stop looping once the count is cleared.

Dummy values are still inserted so that they don't need to timeout
on the queue before exiting (these values are None) so in essence,
this keeps the best of both of worlds.
2018-03-01 20:13:21 +01:00
Lonami Exo
3a3f221bd1 Look in all dialogs when getting entities by peer ID 2018-03-01 20:03:51 +01:00
Lonami Exo
771c573db1 Better attempt at joining update worker threads 2018-03-01 13:31:39 +01:00
Joscha Götzer
835ff51e25 Multiple small changes/fixed typos to docs/error messages (#623) 2018-03-01 13:21:28 +01:00
Joscha Götzer
3184641549 Allow access to events' pattern match (#654) 2018-03-01 00:15:30 +01:00
Lonami Exo
3655df50dc Postpone events resolution 2018-02-28 21:09:05 +01:00
Lonami Exo
3afd7dca84 Invoke multiple getParticipant's at the same time (#580) 2018-02-28 17:10:44 +01:00
Lonami Exo
057c6a0b12 Support getting more than 10k members on .get_participants()
Discussed on #580, original PR made on #639.
2018-02-28 13:24:44 +01:00
Lonami Exo
229cd78df0 Fix markdown's URL regex not acceping newlines 2018-02-27 14:10:02 +01:00
Lonami Exo
d5832e4f3b Fix time offset failing if system time was ahead of time
While the offset was working, the last message ID was never reset,
so it would always pick an higher message ID (safety check), which
completely defeated the purpose of negative time offsets. Should
close #496.
2018-02-27 11:43:42 +01:00
Joscha Götzer
0b662f3b04 Support stopping propagation of events (#622) 2018-02-27 11:30:42 +01:00
Lucas Yuji Suguinoshita Aciole
29f10f2771 Fix named arguments after kwargs (#646)
In Python3, you're unable to send named parameters after **kwargs

* Use single quotes
2018-02-27 10:05:27 +01:00
Lonami Exo
8d1b6629cb Sending open()'ed files would make their name the entire path 2018-02-26 14:14:44 +01:00
Lonami Exo
5a54e2279f Avoid relying on .__iter__ to tell iterators apart
.send_file() would fail with stream objects (those from open())
since they are iterable, and asserting that they weren't bytes
or str was not enough.
2018-02-26 14:12:21 +01:00
Lonami Exo
6f16aeb553 Add logging calls on the TcpClient 2018-02-26 13:41:07 +01:00
Lonami Exo
9604161c91 Fix incoming private messages not working with whitelists
For some reason this was only happening with bots and not
actual private messages. The fix doesn't seem to affect
previous behaviour with actual users in private messages.
2018-02-26 12:15:53 +01:00
Lonami Exo
3b0ab7794b Get name attribute from streams instead always 'unnamed' 2018-02-25 20:35:55 +01:00
Lonami Exo
623c1bd7d1 Add missing parameters to TelegramClient.send_voice_note 2018-02-25 20:34:40 +01:00
Lonami Exo
098602ca13 Let events.Raw.resolve() be a no-op 2018-02-25 10:36:53 +01:00
Lonami Exo
cfc5ecfded Fix tiny bug regarding .get_me(input_peer=True) crashing events 2018-02-25 10:35:39 +01:00
Lonami Exo
9ef75e5070 Allow specifying no event type to default to events.Raw 2018-02-24 18:25:22 +01:00
Lonami Exo
e5aecca79c Update to v0.17.4 2018-02-24 18:08:14 +01:00
Lonami Exo
3301bf3ff6 Fix voice notes default filename being "None - None.oga" 2018-02-24 17:42:32 +01:00
Kyle2142
f9cec54c39 Add .get_participants() convenience method (#639)
Closes #363 and #380.
2018-02-23 21:20:32 +01:00
Lonami Exo
a353679796 Fix downloading from another DC using wrong auth the first time 2018-02-23 13:13:39 +01:00
Lonami Exo
005a8f0a7f Fix .send_file() not respecting MessageMedia captions 2018-02-23 12:10:07 +01:00
Lonami Exo
cda5e59e86 Make .send_message() accept another Message as input 2018-02-23 12:07:57 +01:00
Lonami Exo
448a04a7c5 Stop using InputPeerSelf() on events and special case edit()
Used to fail on the chat with your own (where messages are
"incoming" instead outgoing). Now the ID of the chat and
sender are compared to achieve the same effect. Fixes #632.
2018-02-22 21:01:18 +01:00