Commit Graph

2549 Commits

Author SHA1 Message Date
Lonami Exo
0af823e86c Add three new errors regarding polls 2019-12-26 22:30:07 +01:00
Lonami Exo
29ff3708c4 Handle UpdateMessagePoll in _get_response_message (#1355) 2019-12-26 22:00:41 +01:00
Lonami Exo
86bb4b4e6c Whitelist instead of blacklist in flake8 2019-12-25 12:58:09 +01:00
Lonami Exo
bdff61653a Exclude telethon_examples/ from flake8 2019-12-25 12:07:22 +01:00
Lonami Exo
c3188ff0fa Handle empty list properly in buttons 2019-12-23 14:49:40 +01:00
Lonami Exo
fa736f81af Handle all entity types on isinstance checks
Only the uses of `isinstance` against `InputPeer*` types were
reviewed. Notably, `utils` is exempt on this because it needs
to deal with everything on a case-by-case basis.

Since the addition of `*FromMessage` peers, any manual `isinstance`
checks to determine the type were prone to breaking or being
forgotten to be updated, so a common `helpers._entity_type()`
method was made to share this logic.

Since the conversion to `Peer` would be too expensive, a simpler
check against the name is made, which should be fast and cheap.
2019-12-23 13:52:07 +01:00
Lonami Exo
627e176f8e Handle *FromMessage peers in utils' casts 2019-12-23 13:47:55 +01:00
Lonami Exo
ecb27f33f7 Lower log severity on error during disconnect 2019-12-23 11:54:56 +01:00
Lonami Exo
4499f3b95e Update to layer 106 2019-12-22 11:17:59 +01:00
Lonami Exo
f3111f93b2 Fix unparsing text with malformed message entities 2019-12-19 15:48:59 +01:00
Lonami
ccbc1c669c
Merge pull request #1343 from NotAFile/add-tests
Add example unit test and config for testing
2019-12-14 13:19:49 +01:00
Lonami Exo
7e6f12daa6 Fix ChatAction join/leave in channels, bump v1.10.9 2019-12-11 12:42:51 +01:00
NotAFile
9121478a2e fix first type found by tests :) 2019-12-08 00:30:25 +01:00
NotAFile
8b535473ce add gitlab actions config 2019-12-08 00:29:55 +01:00
NotAFile
30fdf17902 add documentation on test setup 2019-12-07 23:41:02 +01:00
NotAFile
acd14d7bf3 add test checking for #1324 2019-12-07 20:43:29 +01:00
NotAFile
a4876c1ac5 Add example unit test and config for testing
Add testing configuration:
 - pytest as test framework
 - tox for creating testing environments and running tests (run with `tox`)
 - pytest-asycio for asyncio testing
 - coverage/pytest-cov for measuring test coverage
 - flake8 for pep8 checking

I've also added one quick example test demonstrating basic unit testing
and use of the basic fixtures and marks provided by pytest-asyncio.

Just this already covers a suprising 32% of the codebase, mostly through
imports, but I wouldn't expect it to be helpful yet. This should provide
a good base to build on in the future though.
2019-12-07 04:23:27 +01:00
Lonami Exo
b8aa639f3c Check for event loop method, not type (#1337) 2019-12-06 10:23:15 +01:00
Lonami Exo
03f0533139 Fix global search with filter/from_user 2019-12-05 16:19:46 +01:00
Lonami Exo
99d4001db6 Warn users with ProactorEventLoop about proxy issues (#1337) 2019-12-05 11:27:47 +01:00
Lonami Exo
b985dcd248 Fix 3.8 syntax warning and erroneous documentation
Closes #1340 (syntax warning)
Closes #1341 (outdated docs)
2019-12-05 11:14:02 +01:00
Lonami Exo
cd37478e31 Don't send pings unless the connection is made
This will hopefully avoid batching tens of ping requests which
we don't care about their results.
2019-12-02 18:36:20 +01:00
Mengyang Li
149b26fb51 Allow force_document in edit_message (#1335) 2019-11-23 11:00:51 +01:00
Lonami Exo
3a56c8b0f4 Correctly handle flood_sleep_threshold=None and large values
The docstring said large values would be converted to 1 day,
but they were not. With this change None and large values are
handled correctly.

Prevents https://github.com/tulir/mautrix-telegram/issues/380.
2019-11-18 12:51:18 +01:00
Lonami Exo
6817e19923 Fix return value of send_file(album) of the same media 2019-11-10 14:59:01 +01:00
Lonami Exo
57dd0827f4 Slight improvement on ChatAction's docs 2019-11-10 14:59:01 +01:00
painor
38b929b973 Fix several typos (#1328) 2019-11-10 11:29:43 +01:00
painor
4a1310dc21 Fix RSA key unpacking on missing fingerprint (#1324) 2019-11-05 08:54:10 +01:00
painor
4839d8bf59 Fix pin_message not accepting Message objects (#1322) 2019-11-04 09:46:17 +01:00
penn5
3d1ce845be Don't parse Button's text on click (#1315) 2019-11-01 11:47:44 +01:00
Lonami Exo
a1aaa96120 Fix iter_download would not determine file_size alone 2019-10-31 19:38:49 +01:00
Lonami Exo
a67c94787b Make getting PhotoSize byte count more reusable internally 2019-10-31 19:38:27 +01:00
Lonami Exo
7e346180d7 Fix import ssl may fail under some Python installs
It's only required for certain proxy configurations, so we
don't want it to raise ImportError while the user imports
our library.
2019-10-31 19:20:18 +01:00
Lonami Exo
6850903d17 Fix get_edit not always returning awaitable, bump v1.10.8 2019-10-31 10:44:33 +01:00
Lonami Exo
0a3d164806 Fix handling of early edits in Conversation
The incoming messages were never updated, so of course their
edit_date wasn't either. This would cause the library to be
stuck until it timed out, because the event had already
arrived before we waited for it. As an example:

    await conv.send_message('foo')
    await sleep(1)  # bot has plenty of time to respond+edit
    await conv.get_edit()
2019-10-31 10:44:33 +01:00
YouTwitFace
4a8b19b0be Remove @ya from valid usernames (#1306) 2019-10-28 18:12:47 +01:00
Lonami Exo
baacecadc5 Document some errors, bump v1.10.7 2019-10-27 18:50:21 +01:00
Manuel1510
0a8103b6e8 Replace messages.getPeerDialogs with channels.getFullChannel (#1305) 2019-10-27 18:48:41 +01:00
Lonami Exo
5dcc30dcc6 Handle connection errors during auth key generation
This should help with spurious server-side disconnects during
auth_key generation, which happen most commonly on user DC
migrations.
2019-10-24 13:48:29 +02:00
Lonami Exo
08b78f0c47 Unify retry loops in mtprotosender._connect
Now the retry count is not twice its value.
2019-10-24 13:40:09 +02:00
Lonami Exo
3039915ce9 Factor out parts from mtprotosender._connect
This will help unifying the retry loop and reconnecting
if the server disconnects us during auth key generation
which will be done in a follow-up commit.
2019-10-24 13:36:32 +02:00
Lonami Exo
ca2537941c Fix sending albums in conversations 2019-10-22 20:35:08 +02:00
Lonami Exo
6206a1a524 Minor documentation update 2019-10-21 11:45:31 +02:00
YouTwitFace
b862f215c5 Ignore channel-only permissions in megagroups (#1292) 2019-10-11 18:04:41 +02:00
Lonami Exo
09f27f0dd7 Update Telegram's RSA keys 2019-10-03 20:52:25 +02:00
Tanner Collin
72dd36bc17 Allow edit_admin on yourself (#1285) 2019-09-29 09:19:44 +02:00
Lonami
07b0583069
Bump to v1.10.6 2019-09-28 09:44:01 +02:00
penn5
88d8424474 Fix kick_participant in channels (#1284)
Presumably some server-side change made insta-unbanning no longer work.
2019-09-28 09:38:41 +02:00
Lonami Exo
5e6ff67d01 Make allow_cache do nothing for now, bump v1.10.5 (#1272) 2019-09-27 15:12:17 +02:00
Lonami Exo
a360d74a4c Mention pomegranate under projects using the library 2019-09-27 10:41:01 +02:00