Commit Graph

723 Commits

Author SHA1 Message Date
Lonami
6c2363acd2
Merge pull request #396 from LonamiWebs/md-parsing
Support markdown again (implements  #118)
2017-10-30 11:19:48 +01:00
Lonami Exo
7e204632e2 Add parse_mode parameter to TelegramClient.send_message() 2017-10-30 11:17:22 +01:00
Lonami Exo
82cac4836c Fix markdown URL parsing using character index instead offset 2017-10-30 11:15:53 +01:00
Lonami Exo
0a14aa1bc6 Remove additional check when calculating emojies length
This special check treated some emojies as 3 characters long but
this shouldn't have actually been done, likely due to the old
regex matching more things as emoji than it should (which would
have count as 2 too, making up for 1+3 from the new is_emoji()).
2017-10-30 10:56:39 +01:00
Lonami Exo
05f7f076d5 Fix InputPeer* with None hash, drop them off database (closes #354) 2017-10-30 10:33:45 +01:00
Lonami Exo
05626c8274 Implement missing .to_dict() and .stringify() on message/container 2017-10-29 20:13:36 +01:00
Lonami Exo
6567f4b567 Clean .download_contact and a wrong indent level 2017-10-29 20:13:36 +01:00
Lonami Exo
2609bd9bd1 Use constants and allow empty URL regex when parsing markdown 2017-10-29 18:21:21 +01:00
Lonami Exo
d47a9f83d0 Fix some special cases which are not treated as emojis (offset 1) 2017-10-29 17:07:37 +01:00
Lonami Exo
bcaa8007a3 Fix inline URL matching swallowing all parse entities 2017-10-29 16:43:30 +01:00
Lonami Exo
f5fafc6a27 Enhance emoji detection 2017-10-29 16:41:30 +01:00
Lonami Exo
368269cb11 Add ability to parse inline URLs 2017-10-29 16:33:10 +01:00
Lonami Exo
9600a9ea0b Fix markdown parsing failing if delimiter was last character 2017-10-28 19:17:18 +02:00
Lonami Exo
5adec2e1ab Initial attempt at parsing Markdown-like syntax 2017-10-28 19:06:41 +02:00
Andrei Fokau
ef794bf75d Fix importing dependencies during installing (#384) 2017-10-28 12:21:07 +02:00
Lonami Exo
e48f15be80 Fix-up af08d59 (missing parenthesis) 2017-10-28 11:11:51 +02:00
Lonami Exo
2f28050cac Fix generated __bytes__ failing with flag indicator but no flags
Likely since the code was ported to get rid of the BinaryWriter,
since the flag calculation was inlined. Some types (only
channelMessages as of layer 71) had a flag indicator but no flag
arguments, so the calculation of which were not None failed.

This special case is now handled correctly.
2017-10-28 11:09:55 +02:00
Tanuj
af08d59cb7 Fix bug with semicolons when downloading contacts (#319) 2017-10-28 11:09:46 +02:00
Tanuj
39a1d5e90d Replace broken auto_replier.py with new code (#389) 2017-10-28 11:06:34 +02:00
Tanuj
403c7bd00a Make pylint happier on print_updates example (#387) 2017-10-26 18:03:24 +02:00
Andrei Fokau
e6ac61c1b9 Add missing __init__.py to telethon_generator package (#382) 2017-10-25 19:48:46 +02:00
Lonami Exo
c6d30ffceb Fix exception when logging exceptions 2017-10-25 13:06:51 +02:00
Lonami Exo
3db13ccdd2 Add a more descriptive error when serializing bytes 2017-10-25 12:43:57 +02:00
Lonami Exo
e427559d4c Fix username invalid error having wrong username regex 2017-10-25 12:22:38 +02:00
Tanuj
9f9da6adda Remove comma (#376) 2017-10-24 22:08:44 +02:00
Tanuj
d707fd1593 Add example script to print out all updates 2017-10-24 21:32:31 +02:00
Lonami Exo
ceb37cd4c5 Move auth_key generation and InitConnection logic to .invoke()
The reasoning behind this is that .connect() should not call
any request at all, it should only connect to the servers
although it currently still calls GetStateRequest.

There were some issues (#291, #360) where the auth_key was None
(possibly due to .connect() returning False), so this may
fix some of the cases where it returned False. This way we also
ensure that we always have an auth_key, or even if it "breaks"
(it's not the right key for the server anymore).

A few additional changes have been introduced to accommodate
this, such as moving InitConnection logic too or importing auths.
2017-10-24 15:40:51 +02:00
Lonami Exo
b3ca68b7d9 Avoid cyclic imports caused by #348 (fix #357) 2017-10-24 10:07:31 +02:00
Lonami Exo
d58c729af0 Add missing InputPeerSelf case to .get_input_user 2017-10-24 09:43:59 +02:00
Lonami Exo
1f1e040af9 Fix setup.py if/elif/else chain 2017-10-22 13:57:02 +02:00
Lonami Exo
b04eed82eb Add new .idle() method to listen for updates from MainThread 2017-10-22 13:16:34 +02:00
Andrey Egorov
8057cea294 Fix resending requests on bad salt/msg notification (#369)
These responses from the server could indicate container IDs,
which weren't being saved. This fix also accounts for that case.
2017-10-22 13:13:49 +02:00
Lonami Exo
5de8350d85 Reorder another import for #357 2017-10-22 11:23:15 +02:00
Lonami Exo
5f0faee013 Attempt at fixing redundant import from ee01724 (#357) 2017-10-22 11:12:42 +02:00
Lonami Exo
6759beac21 Add __str__ methods to TLMessage and MessageContainer 2017-10-21 20:23:53 +02:00
Lonami Exo
d7f917ebfc Update docstrings 2017-10-21 16:59:20 +02:00
Lonami Exo
f6223bd01a Document the InteractiveTelegramClient more nicely 2017-10-21 16:21:58 +02:00
Lonami Exo
7596f2b797 Fix and enhance "no workers set" warning 2017-10-21 13:48:57 +02:00
Joscha Götzer
9937d58a2d Remove f-strings from codegen to support py <3.6 (#366) 2017-10-21 00:43:26 +02:00
Lonami Exo
5cdf92e509 Update to v0.15.3 2017-10-20 23:33:08 +02:00
Lonami Exo
d70811b693 Fix infinite loop when invoking on update handlers (fix #336)
Every update that hadn't been acknowledged on the main connection
yet would be resent on any new connection. These new connections
are made temporary when invoking anything from any thread that's
not the main thread. It would also process all the updates, hence,
Telegram would be resending these not-acknowledged updates to the
temporary connection, and the updates would be processed again,
then the update handler would react to the duplicated updates over
and over.

To fix this, simply don't process updates on the temporary thread
at all. With this reasoning, if we don't acknowledge updates on
the temporary connections, Telegram will resend them on the main
connection, so we should not lose any.
2017-10-20 23:30:02 +02:00
Lonami Exo
2782a08ed0 Add note for future self when handling gzip packed data 2017-10-20 22:44:00 +02:00
Lonami Exo
1a91c024fc Revert 63dfb1e as many updates were being dropped 2017-10-20 22:12:03 +02:00
Lonami Exo
033119e9b8 Make MtProtoSender._need_confirmation a set
This will avoid adding duplicated items to it
2017-10-20 22:07:45 +02:00
Lonami Exo
83595a0e2d Use more constants in setup.py 2017-10-20 17:32:30 +02:00
Lonami Exo
be9358282a Generate and fetch new errors from setup.py 2017-10-20 17:29:45 +02:00
Lonami Exo
38ccd6d1d9 Generate errors from PWRTelegram's API 2017-10-20 17:20:05 +02:00
Andrey Egorov
f37b9ed20e Fix new salt not being saved to session file (#362) 2017-10-20 16:48:54 +02:00
Andrey Egorov
050cd95d32 Remove unnecessary .disconnect() from ._invoke() (#356) 2017-10-19 10:51:34 +02:00
Lonami Exo
0e1249c833 Fix incorrectly generated code 2017-10-19 10:42:09 +02:00