Commit Graph

86 Commits

Author SHA1 Message Date
Lonami Exo
d8fa0c81f6 Fix-up 52292d7 accessing types under the wrong module 2018-07-23 12:19:41 +02:00
Lonami Exo
52292d77fb Use types. namespace in utils 2018-07-22 19:40:00 +02:00
Lonami Exo
ace7254344 Fix classes MRO and abstractmethod usage
Furthermore utils needs to access the message by reference
through types.Message because it is patched and replaced.
2018-07-22 19:26:34 +02:00
Lonami Exo
a9cc35e604 Avoid triggering FileMigrateError when possible 2018-07-21 11:59:44 +02:00
Lonami Exo
2d7c8908eb Create events.InlineQuery 2018-07-15 11:31:24 +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
baedd10110 Update to layer 82 2018-06-29 13:23:56 +02:00
Lonami Exo
d64eb7ea2b Avoid cyclic imports on older Python versions 2018-06-29 11:04:42 +02:00
Lonami Exo
2bd0c6c525 Support URLs on send_file 2018-06-26 16:39:22 +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
4d1272f1d2 Fix __ is invalid in usernames (cc @Kyle2142) 2018-06-17 12:08:55 +02:00
Lonami
bb3a564500
Merge pull request #843 from LonamiWebs/core-rewrite
Core rewrite
2018-06-14 16:25:28 +02:00
Lonami Exo
317b7053a0 Separate parse message methods from uploads 2018-06-10 11:33:20 +02:00
Lonami Exo
4bd20f1ce2 Separate file and message methods from TelegramClient 2018-06-09 22:05:06 +02:00
Lonami Exo
0418f7e375 Fix get_entities_text and allow filtering by type 2018-06-07 10:46:32 +02:00
Lonami Exo
ed5c44a260 Support deleting more than 100 messages at once 2018-06-05 21:27:49 +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
b667bb0c1a Fix some chat IDs start with 1000 2018-05-20 12:31:57 +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
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
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
17a2946311 Fix get_input_peer allow_self for custom.Dialog 2018-04-13 13:08:29 +02:00
Lonami Exo
0cd44b245c Allow auto-casting custom.Dialog into input_entity 2018-04-06 19:11:31 +02:00
Lonami Exo
8d652c35a1 Add missing Photo/Document cases to get_input_media 2018-03-27 11:22:31 +02: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
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
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
363e751f48 Fix UserList not being considered a list 2018-03-04 00:23:13 +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
Joscha Götzer
835ff51e25 Multiple small changes/fixed typos to docs/error messages (#623) 2018-03-01 13:21:28 +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
359cdcd772 Handle more parsing username cases (closes #630) 2018-02-22 10:27:12 +01:00
Lonami Exo
c31635cc34 Further validate the username on parse_username 2018-02-19 21:03:33 +01:00
Lonami Exo
1eeedc613b Fix sending byte strings as files not working 2018-02-19 15:29:32 +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
9abeefac7f Send video files as video by default instead as document (#601) 2018-02-12 10:33:51 +01:00
Lonami Exo
58d90e7e34 Fix .download_media() not accepting Document 2018-01-23 12:10:23 +01:00
Lonami Exo
81c95b5a60 Fix recursive .get_input_media() forgetting parameters 2018-01-23 12:04:35 +01:00
Lonami Exo
abe26625e6 Add missing ResolvedPeer, InputNotifyPeer, TopPeer cases 2018-01-21 11:04:46 +01:00
Lonami Exo
86816a3bdf Add missing InputChannel case on .get_input_peer() 2018-01-20 19:29:05 +01:00
Lonami Exo
e3c56b0d98 Reduce autocast overhead as much as possible
Rationale: if the user is doing things right, the penalty for
being friendly (i.e. autocasting to the right version, like
User -> InputPeerUser), should be as little as possible.

Removing the redundant type() call to access .SUBCLASS_OF_ID
and assuming the user provided a TLObject (through excepting
whenever the attribute is not available) is x2 and x4 times
faster respectively.

Of course, this is a micro-optimization, but I still consider
it's good to benefit users doing things right or avoiding
redundant calls.
2018-01-19 13:00:17 +01:00
Lonami Exo
49f204c955 Fix .get_input_media using None caption and missing venue type 2018-01-16 14:04:12 +01:00
Lonami Exo
36e2101910 Allow sending multiple files as album (closes #455) 2018-01-15 18:15:30 +01:00
Lonami Exo
55b67b65a1 Remove optional add_mark parameter from .get_peer_id
It was always True after all, and it made no sense for it to
be False.
2017-12-28 13:31:43 +01:00