Commit Graph

42 Commits

Author SHA1 Message Date
Lonami Exo
8d28d1145a Actually fix invalid state in Conversation (1354bf6 followup) 2019-06-15 21:36:06 +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
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
9730894a07 Call Chat/Sender Getter init methods 2019-05-12 14:00:12 +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
6d004601d0 Inline the old _load_entities code 2019-05-01 17:07:12 +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
9090ede5db Reduce __enter__/__exit__ boilerplate for sync ctx managers 2019-04-13 10:53:33 +02: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
e23308c0f9 Fix accessing conversation messages that arrived too early 2019-02-10 11:46:39 +01:00
Lonami Exo
5ac88f764d Fix and update links in the documentation 2019-01-12 13:06:14 +01:00
Lonami Exo
924b59d735 Actually fix cancelling custom conversations from f6bc80b 2018-11-12 08:21:18 +01:00
Lonami Exo
f6bc80bc6b Fix cancellation of custom conversation events from d474458 2018-11-08 10:08:41 +01:00
Kyle2142
eacfa226fd Add Conversation.cancel() (#1030) 2018-10-25 15:37:36 +02:00
Lonami Exo
419fe6dca3 Raise RuntimeError on with blocks that need async 2018-10-17 11:30:07 +02:00
Lonami Exo
0094eb391e Support exclusive conversations by default 2018-10-12 22:17:07 +02:00
Lonami Exo
dedbf29ca4 Fix Conversation.wait_event not resolving them (from d474458) 2018-10-05 13:42:07 +02:00
Lonami Exo
fbc46bd388 Use loop.create_future instead asyncio.Future 2018-08-21 12:22:06 +02:00
Lonami Exo
d3a6822fc9 Properly resolve events 2018-08-21 12:18:12 +02:00
Lonami Exo
47190d7d55 Fix event loop not being passed into many asyncio calls 2018-08-21 11:31:14 +02:00
Lonami Exo
d474458136 Simplify event resolving logic
Although this commit introduces a race condition since an
event may only be half-resolved. A lock is thus needed,
but it depends on an event-loop to which we don't have
access in the class-level.
2018-08-21 11:08:08 +02:00
Lonami Exo
9f237cc928 Simplify event building logic
This will also fix some bugs where the event type being accessed
would not be available, since it is now built on-demand, without
the need to keep track for the count of each event type.
2018-08-21 10:27:12 +02:00
Lonami Exo
06da651f27 Fix edits in custom.Conversation 2018-08-14 18:42:16 +02:00
Lonami Exo
216805d62d Fix telethon.sync for custom.Conversation 2018-08-14 18:41:13 +02:00
Lonami Exo
f332e4c423 Clearer variable naming 2018-08-06 16:31:15 +02:00
Lonami Exo
f39f9a94b5 Remove unnecessary async/await 2018-08-06 16:30:25 +02:00
Lonami Exo
d3a9dcd36c Replace wait code with asyncio.wait_for and pass the client's loop 2018-08-06 16:22:11 +02:00
Lonami Exo
63174ae404 Properly clean-up Conversation 2018-08-05 13:15:19 +02:00
Lonami Exo
26bcc78d14 Fix Conversation.get_response 2018-08-05 12:28:54 +02:00
Lonami Exo
cc067b2569 Add Conversation to the sync magic module 2018-08-05 11:05:01 +02:00
Lonami Exo
48113851a8 Fix built Conversation events don't have the client 2018-08-05 02:01:06 +02:00
Lonami Exo
ca40a9c282 Add Conversation.wait_event 2018-08-05 01:55:41 +02:00
Lonami Exo
1ecb751222 Add Conversation.send_file and .mark_read 2018-08-04 23:21:19 +02:00
Lonami Exo
396b1a4177 Improve getting edits in a Conversation 2018-08-04 15:35:51 +02:00
Lonami Exo
5f73482d29 Restart Conversation total timeout upon __aenter__ 2018-08-04 15:35:04 +02:00
Lonami Exo
785ef7676f Create a basic custom.Conversation 2018-08-03 17:51:56 +02:00