Commit Graph

885 Commits

Author SHA1 Message Date
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
Lonami Exo
f13a7e4afd Allow getting the input peer for yourself and cache it
Warm-up for #632, which needs this information accessible.
2018-02-22 20:37:56 +01:00
Lonami Exo
359cdcd772 Handle more parsing username cases (closes #630) 2018-02-22 10:27:12 +01:00
Lonami Exo
7f35ed59c6 Fix infinite recursion on .get_entity by exact name 2018-02-20 17:30:01 +01:00
Dmitry Bukhta
0731a1d698 Raise ProxyConnectionError instead looping forever (#621)
We shouldn't try reconnecting when using a proxy if what's
unavailable is the proxy server (and not Telegram servers).
2018-02-20 17:05:02 +01:00
Jannik
ea0da8fc0e Add pattern argument on the NewMessage event (#620) 2018-02-20 15:55:02 +01:00
Lonami Exo
4050d1ca00 Support getting entities by exact name/title match 2018-02-19 21:05:39 +01:00
Lonami Exo
c31635cc34 Further validate the username on parse_username 2018-02-19 21:03:33 +01:00
Lonami Exo
39621ceae9 Use req_pq_multi instead req_pq when creating an auth_key 2018-02-19 20:31:47 +01:00
Lonami Exo
bf086f3e80 Fix UpdateDeleteMessages doesn't have .channel_id (#619) 2018-02-19 20:23:52 +01:00
Lonami Exo
1eeedc613b Fix sending byte strings as files not working 2018-02-19 15:29:32 +01:00
Lonami Exo
b136074340 Update to v0.17.3 2018-02-19 15:29:02 +01:00
Lonami Exo
89df481ae4 Make MessageChanged.Event inherit NewMessage.Event 2018-02-18 14:07:13 +01:00
Lonami Exo
b93e1b5f50 Add add_event_handler and deprecate add_update_handler 2018-02-18 13:29:05 +01:00
Lonami Exo
1179c9e21b Fix start not asking for password if needed 2018-02-18 12:17:02 +01:00
Lonami Exo
33fd6895d3 Use hachoir to determine audio and video metadata if possible
Closes #611
2018-02-17 13:01:12 +01:00
Lonami Exo
2bfe86cda1 Fix bot_token could not be specified alone on .start() 2018-02-17 12:32:30 +01:00
Lonami Exo
d581589313 Add missing UpdateShortChatMessage case on events.NewMessage 2018-02-17 11:40:38 +01:00
Lonami Exo
6d993af338 Move events chats and blacklist_chats into the base, reuse code 2018-02-17 11:29:16 +01:00
Lonami Exo
8718cf0e7e Reuse turning chats into a set of IDs and handle self case 2018-02-17 10:41:43 +01:00
Lonami Exo
83d9d1d78e Fix markdown parser not inverting delimiters dict 2018-02-16 20:30:19 +01:00
Lonami Exo
030f292203 Dump libssl bindings in favour of the new optional cryptg module 2018-02-16 18:24:44 +01:00
Lonami Exo
c11aefa95b Fix message entities being ignored by edit_message 2018-02-16 13:42:12 +01:00
Lonami Exo
8194288797 Update to v0.17.2 2018-02-15 22:43:07 +01:00