Commit Graph

294 Commits

Author SHA1 Message Date
Lonami Exo
312dac90a3 Improve inline result documentation with more examples 2020-10-15 10:42:40 +02:00
Lonami Exo
9c5b9abb93 Fix sending of documents in inline results 2020-10-15 10:40:41 +02:00
Lonami Exo
7c3bbaca2a Support not including the media from inline results in the msg 2020-10-15 10:40:19 +02:00
Lonami Exo
15f7c27bce Fix .photo()/.document() inline results excluding media from msg 2020-10-15 09:29:19 +02:00
Lonami Exo
adf52a1b74 Expose entity parameter in client.inline_query
Some bots, such as @gamee, use this to determine the type of results
to return (and "disable" themselves in channels).
2020-10-11 16:59:48 +02:00
Lonami Exo
5722ba8306 Revert add_admins property logic since it differs from the rest 2020-10-07 10:40:34 +02:00
khoben
ce71b3293b
Support Message.click() for polls (#1583) 2020-10-07 09:21:33 +02:00
Lonami Exo
05af5d0d74 Avoid redundant code in ParticipantPermissions 2020-10-06 11:14:16 +02:00
Lonami Exo
cf1645b598 Improve documentation for ParticipantPermissions 2020-10-06 11:14:16 +02:00
Lonami Exo
7f61b92f81 Add anonymous permission to edit_admin and get_permissions 2020-10-06 11:14:16 +02:00
Lonami Exo
20606b3a71 Fix from_users filter not accounting for None from_id 2020-10-05 14:01:50 +02:00
Lonami Exo
bb3ccca333 Fix Python 3.5 compatibility issue 2020-10-05 10:50:47 +02:00
apepenkov
3e188d0344
Add missing check for permissions.is_creator (#1578) 2020-10-03 17:16:10 +02:00
kolay
fc765f6014
Add new get_permissions method (#1575)
Closes #1574.
2020-10-03 16:59:54 +02:00
Lonami Exo
4321153b06 Correctly emulate old to_id behaviour 2020-10-02 10:23:04 +02:00
Lonami Exo
5c93ea8019 Fix from_id/sender_id value on message updates 2020-10-01 21:22:27 +02:00
Lonami Exo
572229e536 Add aliases to access new msg fields with old names 2020-10-01 20:37:07 +02:00
Lonami Exo
668dcd52ca Update global search to properly use offset_rate 2020-10-01 12:23:34 +02:00
Lonami Exo
d5e4398ace Adapt the rest of the library to layer 119 2020-10-01 12:22:55 +02:00
Lonami Exo
62737c1caf Partially upgrade to layer 119 2020-10-01 09:17:18 +02:00
Lonami Exo
c864ef7e16 Refetch msg if fileref expires while downloading docs
Closes #1301.
2020-09-24 10:03:28 +02:00
Lonami Exo
1c3e7dda01 Avoid explicitly passing the loop to asyncio
This behaviour is deprecated and will be removed in future versions
of Python. Technically, it could be considered a bug (invalid usage
causing different behaviour from the expected one), and in practice
it should not break much code (because .get_event_loop() would likely
be the same event loop anyway).
2020-07-25 18:39:35 +02:00
Lonami Exo
326f70b678 Support clicking on buttons asking for phone/location
Closes #1492.
2020-07-04 13:29:43 +02:00
Lonami Exo
7b852206f1 Fix click timeout error is now different 2020-07-04 13:29:43 +02:00
Tulir Asokan
ba4f4c1f78
Fix url property in QRLogin (#1494) 2020-06-24 14:11:54 +02:00
Lonami Exo
e0c3143763 Update documentation with new errors and further clarifications 2020-06-22 13:21:45 +02:00
Lonami Exo
3f74f83964 Move qrlogin with the rest of custom types 2020-06-06 13:47:56 +02:00
JuniorJPDJ
634bc3a8bd
Allow event's func to be async (#1461)
Fixes #1344.
2020-05-16 09:58:37 +02:00
Lonami Exo
c43e2a0a3a Return produced service message with pin_message
Fixes #1394.
2020-04-29 10:29:14 +02:00
Lonami Exo
74bced75b4 Check if the conversation was cancelled on send methods
Fixes #1411.
2020-04-28 21:02:27 +02:00
Lonami Exo
71ed1564cb Add a new .dice property to Message 2020-04-27 20:43:09 +02:00
Lonami Exo
22e645e22f Update to layer 109 2020-01-23 13:43:20 +01:00
Lonami Exo
d68d70362b Handle PeerIdInvalidError in delete_dialog 2020-01-07 12:14:19 +01:00
Lonami Exo
bea4225d28 Don't reply to message on text button click (#1351)
Official clients don't do it, so we probably shouldn't either.
2019-12-27 10:56:26 +01:00
painor
38b929b973 Fix several typos (#1328) 2019-11-10 11:29:43 +01:00
penn5
3d1ce845be Don't parse Button's text on click (#1315) 2019-11-01 11:47:44 +01:00
Lonami Exo
a67c94787b Make getting PhotoSize byte count more reusable internally 2019-10-31 19:38:27 +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
Lonami Exo
ca2537941c Fix sending albums in conversations 2019-10-22 20:35:08 +02:00
Lonami Exo
d1ddfd09b6 Update missing links in the documentation summary 2019-09-24 16:19:56 +02:00
Lonami Exo
6e9d799103 Actually fix message.document for webpages (57049d follow-up) 2019-09-08 11:06:54 +02:00
Lonami Exo
9dd73cd494 Update to layer 105 2019-09-06 13:10:27 +02:00
Lonami Exo
57049de23a Fix message.document for webpages 2019-09-06 13:09:07 +02:00
Lonami Exo
e1905d0d7a Avoid using telethon.sync in the examples 2019-08-13 23:33:39 +02:00
Lonami Exo
61c0e63bbe Avoid unnecessary await in Conversation 2019-08-13 18:11:02 +02:00
Lonami Exo
969a36c2a8 Update docs for silent parameter
Since it now also works in private chats to "not disturb friends"
(see https://telegram.org/blog/silent-messages-slow-mode).
2019-08-10 09:06:05 +02:00
Lonami Exo
8a933afc5d Support iterating over specific drafts more easily 2019-08-01 20:15:32 +02:00
Lonami Exo
2ace4fde41 Fix Forward had its client set to None (#1247) 2019-07-31 11:04:08 +02:00
Lonami Exo
5a225d1668 Fix a dialog's message could be wrong in rare cases 2019-07-23 12:44:19 +02:00
Lonami Exo
4bf85d9e8e Add new Button.auth (#1235) 2019-07-17 12:25:29 +02:00
Lonami Exo
ec093f90e7 Fix InputKeyboardButtonUrlAuth was not considered inline 2019-07-16 18:47:28 +02:00
Lonami Exo
8e36bb4c4d Link Python keywords with Python's documentation 2019-07-06 12:11:00 +02:00
Lonami Exo
e8327da189 Fix some methods in Message were not checking for client 2019-06-30 16:34:34 +02:00
Lonami Exo
84c4fcdec6 Fix entities weren't being passed to Draft 2019-06-28 20:34:30 +02:00
Lonami Exo
4f1edeb750 Let File.ext work even with unknown mime types 2019-06-26 11:31:15 +02:00
Lonami Exo
80c9c5dad3 Avoid memory cycle in Forward 2019-06-26 11:16:17 +02:00
Lonami Exo
3c68208c41 Update to layer 102 2019-06-23 21:23:40 +02:00
Lonami Exo
83789aaa42 Return None from ChatGetter when there isn't enough info 2019-06-19 11:46:03 +02:00
Lonami Exo
8d28d1145a Actually fix invalid state in Conversation (1354bf6 followup) 2019-06-15 21:36:06 +02:00
Lonami Exo
5877459907 Create Message.mark_read() 2019-06-15 19:41:31 +02:00
Lonami Exo
065719c8d8 conversation.cancel() now raises cancelled on future calls (#1183) 2019-06-03 19:44:43 +02:00
Lonami Exo
4c3e467d25 Add a method to cancel_all conversations (#1183) 2019-06-03 19:41:22 +02:00
Lonami Exo
690a40be77 Better behaviour for conversation.cancel() (#1183) 2019-06-03 19:29:08 +02:00
Lonami Exo
e47f3ec1d6 Clarify some aspects of the documentation 2019-06-01 16:28:20 +02:00
Lonami Exo
5832ab2f31 Create new client.pin_message method 2019-05-30 17:15:50 +02:00
Lonami Exo
0d64fd98f7 Create new client.delete_dialog method 2019-05-30 13:58:05 +02:00
Lonami Exo
e4158acd08 Update to layer 100 2019-05-30 13:23:47 +02:00
Lonami Exo
1354bf68a8 Factor out clearing items from pending in conversations
This should prevent bugs and ease reasoning, since
now everything is removed from a single place.
2019-05-27 14:23:42 +02:00
Lonami Exo
0b41454b01 Fix conversation setting result on cancelled futures
On timeout, they are cancelled. On a new message
arriving, we pop and set the result unconditionally.

    conv.send_message('Talk to me please')
    conv.get_response()
    try: conv.get_response(timeout=0.1)
    except asyncio.TimeoutError: pass
    conv.send_message('One more time...')
    conv.get_response()  # errors unless above is commented
2019-05-27 14:10:38 +02:00
Lonami Exo
465f38c1c6 Fix message.text behaviour with no parse mode 2019-05-20 12:00:52 +02:00
Lonami Exo
383ab9b0b2 Fix message.text not checking if parse_mode was set 2019-05-20 11:57:11 +02:00
Lonami Exo
9730894a07 Call Chat/Sender Getter init methods 2019-05-12 14:00:12 +02:00
Lonami Exo
313caf440e Add friendly methods for archiving dialogs 2019-05-10 18:12:16 +02:00
Lonami Exo
0a3d6106f0 Completely overhaul the documentation 2019-05-09 12:50:09 +02:00
Lonami Exo
10251f9782 Create a new Message.file property (#1168) 2019-05-08 18:41:40 +02:00
Lonami Exo
c6691dc6a8 Update the reference with even more types and other docs 2019-05-07 21:25:55 +02:00
Lonami Exo
f5e611e4d2 Fix SenderGetter was excepting the wrong type 2019-05-04 19:30:33 +02:00
Lonami Exo
adc9b4c9f1 Fix SenderGetter should not define abstract methods
Or at least it shouldn't if subclasses are likely to not
implement them, which causes an error if left un-implemented.
2019-05-04 17:59:21 +02:00
Lonami Exo
1e17ef1c98 Apply several lints 2019-05-03 21:38:41 +02:00
Lonami Exo
cb56c54351 Use the entity cache in sender getter 2019-05-02 18:51:10 +02:00
Lonami Exo
1a00de6494 Add missing checks in the message for is client None 2019-05-02 18:44:28 +02:00
Lonami Exo
3a1496c205 Reuse code for _get_entity_pair
Less error-prone, improved the function flow for all callers,
and removed some duplicate work.
2019-05-01 17:52:32 +02:00
Lonami Exo
6d004601d0 Inline the old _load_entities code 2019-05-01 17:07:12 +02:00
Lonami Exo
9a400748f7 Fix InlineBuilder only working with local files 2019-05-01 16:02:21 +02:00
Lonami Exo
1ead9757d3 Fix Conversation not allowing getting responses after ID 0 2019-04-29 08:54:10 +02:00
Lonami Exo
599a5ac3ff Fix using events.Raw after 1b6b4a5 2019-04-29 08:54:10 +02:00
Lonami Exo
1b6b4a57d9 Attempt at reducing CPU usage after c902428
This attempt removes the forced `await` call, which could
be causing that extra usage. Some more boilerplate is needed.
2019-04-23 20:17:43 +02:00
Lonami Exo
8868ce14e8 Update to layer 98 2019-04-22 16:51:05 +02:00
Lonami Exo
9090ede5db Reduce __enter__/__exit__ boilerplate for sync ctx managers 2019-04-13 10:53:33 +02:00
Lonami Exo
29b21209bf Force fetch sender/chat if only min information was given 2019-04-05 21:28:31 +04:00
Lonami Exo
a59f53d592 Load entities for new via_bot property and forward 2019-03-28 11:07:41 +01:00
Lonami Exo
39d9531483 Implement _load_entities for all events
Follow-up of c902428af1
This means that now input_chat (and even chat_id) and
similar can be safely used, without needing get_input
2019-03-28 10:47:15 +01:00
Lonami Exo
8abc7ade22 Use the new in-memory entity cache
This should avoid a disk access every time an input entity
is needed, which is very often. Another step for #1141.
2019-03-26 11:39:25 +01:00
Lonami Exo
7c48857d0c Update docs for send_file/timeouts and add new known error 2019-03-18 17:34:48 +01:00
Lonami Exo
916b379c03 Work around message edits arriving too early in conversations 2019-03-11 13:03:10 +01:00
Lonami Exo
628a16f287 Document new errors and limits for inline results 2019-02-14 19:45:25 +01:00
Lonami Exo
e23308c0f9 Fix accessing conversation messages that arrived too early 2019-02-10 11:46:39 +01:00
Lonami Exo
10cd61d2f9 Add missing timezone info in important places
Things like SQLAlchemy work correctly only for timezone-aware datetimes.
The returned TLObjects all have them, but those that are manually created
were missing them, so serializing the state into SQLAlchemy sessions failed.
2019-01-24 11:16:40 +01:00
Lonami Exo
bb5c1f24c6 Update to layer 93 2019-01-21 20:09:13 +01:00