Commit Graph

210 Commits

Author SHA1 Message Date
painor
42d5c0fe6d Add pattern parameter to events.CallbackQuery (#1212) 2019-07-05 21:03:07 +02:00
Lonami Exo
3f19f6fd50 Return None in UserUpdate if information is unknown 2019-07-04 10:34:48 +02:00
Lonami Exo
99b15b916c Turn UserUpdate attributes into properties
This aids discoverability, makes them lazily-loaded,
and in general is more consistent and easier to extend.
2019-07-04 10:17:40 +02:00
Lonami Exo
7285b156f4 Create events.Album (#1216) 2019-06-30 16:34:34 +02:00
Lonami Exo
a7a7c4add2 Pass all Updates when building events 2019-06-30 16:34:34 +02:00
Lonami Exo
aa2b3daccc Factor out setting entities to events 2019-06-30 16:34:34 +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
51de0bd2da Update documentation with intersphinx and better summaries 2019-06-11 11:09:22 +02:00
Lonami Exo
e47f3ec1d6 Clarify some aspects of the documentation 2019-06-01 16:28:20 +02:00
Lonami Exo
80f19bd1f0 Point to the new domains 2019-05-22 11:29:46 +02:00
Terrance
0946a7902f Fix super() initialisation call for EventCommon (#1182) 2019-05-12 23:29:01 +02:00
Lonami Exo
9730894a07 Call Chat/Sender Getter init methods 2019-05-12 14:00:12 +02:00
Lonami Exo
0a3d6106f0 Completely overhaul the documentation 2019-05-09 12:50:09 +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
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
22124b5ced Refactor code to fetch missing entities once again
This is another attempt at reducing CPU usage similar to:
    1b6b4a57d9

In addition it simplifies some of the code and opens up new
ideas for the state cache as well.
2019-05-01 14:02:27 +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
4e783728f9 Don't catch up on reconnect and fix typo
The feature is not ready yet.
2019-04-22 16:56:32 +02:00
Lonami Exo
6d83b16503 Fix CallbackQuery ignoring func 2019-04-13 16:42:53 +02:00
Lonami Exo
85be48f42b Document misleading message.out value for events.MessageEdited 2019-04-02 08:39:19 +02:00
Lonami Exo
38900c5079 Fix CallbackQuery.edit for normal queries (0b4d649) 2019-04-02 08:37:24 +02:00
Lonami Exo
34a8140ff0 Fix MessageRead had blacklist_chat=None and not False
This was causing the checks against chats to fail. In addition
to that, before setting the attribute, it is now casted to bool
to prevent more issues like this in the future (or if users
use non-boolean values).
2019-03-31 12:15:48 +02:00
Lonami Exo
c95467ea3e Fix ._chat_peer could be None in Event.filter() 2019-03-31 12:15:48 +02: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
c902428af1 getDifference if the event's chat was not found (WIP) 2019-03-27 16:21:17 +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
facf3ae582 Fix-up user_id for UserUpdate 2019-03-26 09:18:18 +01:00
Lonami Exo
0239852cc7 Fix UserUpdate in chats 2019-03-26 09:14:55 +01:00
Lonami Exo
9db9db1ade Fix UserUpdate not working for typing updates
The code to deal with the right chat action was there,
but the updates that could trigger that code path were
never checked.
2019-03-26 08:57:16 +01:00
Lonami Exo
0b4d64947b Fix CallbackQuery.edit for messages via inline queries 2019-03-23 19:25:45 +01:00
Lonami Exo
934c733ccb Treat users "kicking themselves" as leaving (#1116) 2019-02-27 19:42:17 +01:00
Lonami Exo
f540c4e089 Fix order of inline results not being preserved 2019-02-14 20:03:02 +01:00
Lonami Exo
628a16f287 Document new errors and limits for inline results 2019-02-14 19:45:25 +01:00
Lonami Exo
5ac88f764d Fix and update links in the documentation 2019-01-12 13:06:14 +01:00
Lonami Exo
d31aaa5d0d Make Message.edit respect preview and buttons 2019-01-12 12:45:37 +01:00
Lonami Exo
09f994c105 Except TypeError on empty access hash from 5018879 thoroughly 2018-12-18 08:39:36 +01:00
Lonami Exo
4a8a85d7a6 Refetch ChatAction service message to get input users 2018-11-28 18:59:49 +01:00
Lonami Exo
d214c78bd0 Add missing @property decorator 2018-11-19 12:06:18 +01:00
Lonami Exo
e5fc9d8674 Fix several broken links in the docs 2018-10-17 11:50:11 +02:00
Lonami Exo
a9a2401e44 Fix CallbackQuery using string regex 2018-10-17 11:44:08 +02:00
Lonami Exo
74f7ae525f Document InlineBuilder 2018-10-12 12:38:46 +02:00
Manuel1510
2468b32fc5 Implement next_offset and allow empty results in answer() (#1017) 2018-10-04 09:12:12 +02:00
Lonami Exo
ec0aa65fe1 An user -> a user 2018-09-22 19:18:42 +02:00
Lonami Exo
d5d3733fd4 Create events.register and siblings for "handler templates"
This can be thought of as a different approach to Flask's blueprints.
2018-09-22 12:51:58 +02:00
Lonami Exo
5e13a6f7a8 Fix-up get_message failing for UpdateInlineBotCallbackQuery 2018-09-19 16:42:22 +02:00
Lonami Exo
ac59cfa25b Return chat from inline queries that "don't have it" 2018-09-19 16:40:35 +02:00
Lonami Exo
2f09e5c335 Support custom-callback filter for all events 2018-09-09 15:48:54 +02:00
Lonami Exo
576ac666d9 Fix resolving events while disconnected 2018-08-27 01:20:01 +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
f4b9c9d6d4 Remove critical code from assert statements 2018-08-14 19:14:13 +02:00
Lonami Exo
96742334a4 Fix incoming = outgoing = True not working 2018-07-29 13:03:10 +02:00
Lonami Exo
7b22c72c3e Use UTC timezone for events.UserUpdate 2018-07-24 20:38:38 +02:00
Lonami Exo
1c0d595205 Replace custom.Message creation with ._finish_init 2018-07-22 19:20:55 +02:00
Lonami Exo
7f78d7ed2f Use classmethod for all Event.build 2018-07-19 01:47:32 +02:00
Lonami Exo
2d7c8908eb Create events.InlineQuery 2018-07-15 11:31:24 +02:00
Lonami Exo
8b4c8d30e7 Fix events.MessageDeleted setting readonly properties 2018-07-11 11:34:20 +02:00
Lonami Exo
1d0fd6801d Build events only once per update 2018-07-11 11:22:43 +02:00
Lonami Exo
f6c45dcc63 Support filtering events.CallbackQuery 2018-07-10 17:59:13 +02:00
Lonami Exo
05e8e60291 Create events.CallbackQuery 2018-07-10 17:59:13 +02:00
Lonami Exo
8eecd9c226 Reuse code to get chat and sender 2018-07-10 17:59:13 +02:00
Lonami Exo
3a9cce8720 Add missing async/await to events' documentation 2018-07-08 15:11:10 +02:00
Lonami Exo
72835dfb44 Update to v1.0 2018-06-27 13:41:20 +02:00
Lonami Exo
75dc4809f5 Remove all deprecated methods 2018-06-26 11:10:11 +02:00
Lonami Exo
c1046c2acc Fix "user joined" being "user added itself" 2018-06-25 13:21:23 +02:00
Lonami Exo
410518aa65 Stop using await with properties 2018-06-25 11:38:56 +02:00
Lonami Exo
efc9f4c414 Get rid of all remaining async properties 2018-06-25 11:03:20 +02:00
Lonami Exo
266d44dd86 Fix EventsCommon still having async properties 2018-06-24 13:05:58 +02:00
Lonami Exo
1a1d9d346c Fix most private messages being outgoing since 56ddaae
56ddaae checked to_id and from_id to compare if they were equal,
and if they were, mark the event as outgoing for convenience in
your private chat (saved messages).

However when reconstructing the Message from UpdateShortMessage
to_id didn't mimic 100% Telegram's behaviour (the chat to which
the message is sent is "different" depending on who sent the
messages). This bug is what actually caused most messages to
be outgoing, even though 56ddaae's logic is correct.
2018-06-22 10:25:20 +02:00
Lonami Exo
f733f8e565 Rewrite the first part of the docs for asyncio 2018-06-21 21:54:54 +02:00
Lonami Exo
9e3f6483e8 Fix pattern= and move pattern_match to events.NewMessage 2018-06-20 20:03:44 +02:00
Lonami Exo
c893eaaa84 Allow filtering new messages by sender/forwards 2018-06-20 11:58:44 +02:00
Lonami Exo
c85ba4accc Revisit documentation, cross-references and unnecessary indents 2018-06-20 11:06:03 +02:00
Lonami Exo
56ddaaee6f Make non-fwded messages sent to yourself outgoing 2018-06-16 17:35:24 +02:00
Lonami Exo
24d2074e0c Set _input_chat on custom.Message creation/fixup input_chat 2018-06-14 23:40:44 +02:00
Lonami Exo
f95400ea7e Try again to get input_chat on EventsCommon 2018-06-14 23:26:04 +02:00
Lonami Exo
179af9894f Add missing parenthesis around await 2018-06-14 22:25:03 +02:00
Lonami Exo
908dfa148b Revisit codebase to add missing async/await 2018-06-14 17:09:20 +02:00
Lonami Exo
3ce8b17193 Dispatch updates to event handlers 2018-06-13 16:20:15 +02:00
Lonami Exo
2e43fb3217 More nasty hacks to fix events.NewMessage attrs 2018-06-03 17:09:36 +02:00
Lonami Exo
997f2b62ce Fix EventCommon/custom.Message conflicting properties 2018-06-03 16:41:13 +02:00
Lonami Exo
b2ed6caff4 Fix setattr for events.NewMessage/custom.Message 2018-06-03 13:00:07 +02:00
Lonami Exo
8d7c7a19c0 Add some setters for custom.Message 2018-06-03 11:53:18 +02:00
Lonami Exo
f7222407de Document custom.Message 2018-06-02 12:52:38 +02:00
Lonami Exo
5c76af34aa Fix copy-paste typo 2018-06-02 12:38:47 +02:00
Lonami Exo
6dcd0911a7 Move events.NewMessage properties to custom.Message 2018-06-02 12:30:25 +02:00
Lonami Exo
9e4854fcce Use custom.Message in events 2018-05-31 13:30:22 +02:00
Lonami Exo
6c20f8a2c7 Set is private/group=True for messages deleted out of channels 2018-05-28 18:27:44 +02:00
Lonami Exo
a1b22e0911 Support incoming=False to indicate outgoing=True 2018-05-28 18:25:01 +02:00
Lonami Exo
cffef411b2 Enhance documentation 2018-05-17 12:00:22 +02:00
Lonami Exo
d6935355ae Fix two tiny typos 2018-04-28 13:42:36 +02:00
Lonami Exo
ce7e5abb58 Support filtering events.Raw by update type 2018-04-28 13:37:19 +02:00
Lonami Exo
5c6ac18a52 Attach original_update to all events 2018-04-28 12:58:41 +02:00
Lonami Exo
f31ca142a3 Support autocast to InputMessage 2018-04-23 11:05:38 +02:00
Lonami Exo
a13863a4fb Re-export events.Raw (removed on b7c3f80) 2018-04-13 17:36:23 +02:00
Lonami Exo
414fec91f1 Stop using input version on events to just get the ID 2018-04-08 15:55:10 +02:00