Commit Graph

56 Commits

Author SHA1 Message Date
Dan
7f79210ba3 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/dispatcher/dispatcher.py
#	requirements.txt
2019-01-02 19:55:45 +01:00
Dan
1960b00280 Add a way to stop iterating through handlers
Closes #125
2019-01-02 18:11:22 +01:00
Dan
4d7b1bafac Update copyright year 2019-01-01 12:36:16 +01:00
Dan
f5ce49b7b2 - Fix small glitches introduced when merging.
- Remove typing requirement, asyncio branch already needs Python 3.5+.
- Add async_lru as extra requirement because the standard lru_cache
  doesn't work in asyncio world.
2018-12-22 14:08:29 +01:00
Dan
e6667be10b Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/dispatcher/dispatcher.py
#	pyrogram/client/ext/utils.py
#	pyrogram/client/methods/bots/get_inline_bot_results.py
#	pyrogram/client/methods/bots/request_callback_answer.py
#	pyrogram/client/methods/bots/send_inline_bot_result.py
#	pyrogram/client/methods/chats/delete_chat_photo.py
#	pyrogram/client/methods/chats/export_chat_invite_link.py
#	pyrogram/client/methods/chats/get_chat.py
#	pyrogram/client/methods/chats/get_chat_member.py
#	pyrogram/client/methods/chats/get_chat_members.py
#	pyrogram/client/methods/chats/get_chat_members_count.py
#	pyrogram/client/methods/chats/get_dialogs.py
#	pyrogram/client/methods/chats/join_chat.py
#	pyrogram/client/methods/chats/kick_chat_member.py
#	pyrogram/client/methods/chats/leave_chat.py
#	pyrogram/client/methods/chats/pin_chat_message.py
#	pyrogram/client/methods/chats/promote_chat_member.py
#	pyrogram/client/methods/chats/restrict_chat_member.py
#	pyrogram/client/methods/chats/set_chat_description.py
#	pyrogram/client/methods/chats/set_chat_photo.py
#	pyrogram/client/methods/chats/set_chat_title.py
#	pyrogram/client/methods/chats/unban_chat_member.py
#	pyrogram/client/methods/chats/unpin_chat_message.py
#	pyrogram/client/methods/contacts/add_contacts.py
#	pyrogram/client/methods/contacts/delete_contacts.py
#	pyrogram/client/methods/messages/delete_messages.py
#	pyrogram/client/methods/messages/edit_message_caption.py
#	pyrogram/client/methods/messages/edit_message_media.py
#	pyrogram/client/methods/messages/edit_message_reply_markup.py
#	pyrogram/client/methods/messages/edit_message_text.py
#	pyrogram/client/methods/messages/forward_messages.py
#	pyrogram/client/methods/messages/get_history.py
#	pyrogram/client/methods/messages/get_messages.py
#	pyrogram/client/methods/messages/send_animation.py
#	pyrogram/client/methods/messages/send_audio.py
#	pyrogram/client/methods/messages/send_chat_action.py
#	pyrogram/client/methods/messages/send_contact.py
#	pyrogram/client/methods/messages/send_document.py
#	pyrogram/client/methods/messages/send_location.py
#	pyrogram/client/methods/messages/send_media_group.py
#	pyrogram/client/methods/messages/send_message.py
#	pyrogram/client/methods/messages/send_photo.py
#	pyrogram/client/methods/messages/send_sticker.py
#	pyrogram/client/methods/messages/send_venue.py
#	pyrogram/client/methods/messages/send_video.py
#	pyrogram/client/methods/messages/send_video_note.py
#	pyrogram/client/methods/messages/send_voice.py
#	pyrogram/client/methods/password/change_cloud_password.py
#	pyrogram/client/methods/password/enable_cloud_password.py
#	pyrogram/client/methods/password/remove_cloud_password.py
#	pyrogram/client/methods/users/delete_user_profile_photos.py
#	pyrogram/client/methods/users/get_me.py
#	pyrogram/client/methods/users/get_user_profile_photos.py
#	pyrogram/client/methods/users/get_users.py
#	pyrogram/client/methods/utilities/download_media.py
#	pyrogram/client/types/messages_and_media/message.py
2018-12-22 12:23:08 +01:00
Dan
e8fbae3166 Make all parse methods protected to hide them from the lib user 2018-12-19 13:00:33 +01:00
Dan
1344e95be6 Use the new parsers in dispatcher.py 2018-12-17 16:40:06 +01:00
Dan
017c61a876 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/dispatcher/dispatcher.py
#	pyrogram/client/methods/bots/request_callback_answer.py
#	pyrogram/client/types/messages_and_media/message.py
2018-11-20 19:40:07 +01:00
Aleksandr Pyatnitsin
40d7ed2b8e
fix RawUpdateHandler 2018-11-14 23:21:19 +03:00
Dan
d5ef03d662 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/__init__.py
#	pyrogram/client/client.py
#	pyrogram/client/dispatcher/dispatcher.py
2018-11-13 20:36:04 +01:00
Dan
e400641204 Fix Dispatcher bad behaviours in case of multiple Clients running at the same time. 2018-11-13 20:31:53 +01:00
Dan
7bc4490680 Rework dispatcher for asyncio 2018-11-09 10:10:26 +01:00
Dan
301ba799cf Fix update_worker not being async 2018-11-09 09:41:49 +01:00
Dan
14feffce84 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/dispatcher/dispatcher.py
#	pyrogram/client/ext/utils.py
#	pyrogram/client/types/messages_and_media/message.py
2018-11-09 09:33:00 +01:00
Dan
23fd39e2c8 Update dispatcher.py 2018-11-09 09:21:01 +01:00
Dan
3f0a355f7e Further optimize and simplify the Dispatcher 2018-10-19 11:54:27 +02:00
Dan
09e0345868 Small dispatcher clean ups 2018-10-18 21:18:22 +02:00
Dan
38ff950d01 Remove useless #noinspection 2018-10-17 21:00:14 +02:00
Dan
426cdbbcb8 Don't make use of Update objects when dispatching updates
The Update type is used nowhere, adds costly abstraction and makes the
code uglier. If I ever need it again (unlikely) I can just revert this.
2018-10-17 20:59:33 +02:00
Dan
a315c30336 Optimize dispatcher.py code 2018-10-17 20:37:53 +02:00
Dan
418eb0b01a Fix asyncio dispatcher 2018-10-16 12:38:50 +02:00
Dan
f45e3377a9 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/methods/users/delete_user_profile_photos.py
2018-10-16 12:20:46 +02:00
Dan
5b17376801 Enable dispatching of user status updates 2018-10-15 10:18:22 +02:00
Dan
e5f233b01e Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/dispatcher/dispatcher.py
#	pyrogram/client/ext/utils.py
2018-10-09 16:38:28 +02:00
Dan
1be144288c Add a proxy to the Client instance inside CallbackQuery objects 2018-10-09 14:07:01 +02:00
Dan
fcdb71c28c Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/dispatcher/dispatcher.py
#	pyrogram/client/methods/chats/promote_chat_member.py
2018-10-01 16:21:14 +02:00
Dan
0162cf48c1 Don't break groups in case one handler raises an unhandled exception
The error is logged instead. Fixes #126
2018-10-01 09:55:09 +02:00
Dan
532ad6bd81 Fix develop merge issues with asyncio branch 2018-06-21 18:02:16 +02:00
Dan
d2a15d8143 Merge branch 'develop' into asyncio 2018-06-21 15:35:27 +02:00
Vitali
e6c6bd839c Add Handler to deleted messages update 2018-06-19 11:18:12 -03:00
Dan
09dd715556 Small tweaks 2018-06-18 21:12:04 +02:00
Dan
9a5ce0fe2d Clean up dispatcher and fix workers not being stopped correctly 2018-06-18 13:06:07 +02:00
Dan
0a6583a43c Turn the Dispatcher async 2018-06-17 18:41:07 +02:00
Dan
682a3ae948 Dispatch inline bot callback queries 2018-06-06 12:29:21 +02:00
Dan
93218a6ed7 Remove handlers lock 2018-05-26 18:04:17 +02:00
Dan
cc9aeb290a Don't process empty messages 2018-05-09 21:40:24 +02:00
Dan
a1c3e40800 Make parse_messages accept a list of messages 2018-05-09 19:29:23 +02:00
Dan
8454d438be Refactor the project by using Mixin classes
This will cut client.py down from ~4k to ~1k SLOC and also
makes the whole project tidier and more organized.
2018-05-07 14:30:55 +02:00
Dan
e2224054d2 Merge branch 'remove-handler-and-locks' of https://github.com/JosXa/pyrogram into JosXa-remove-handler-and-locks
# Conflicts:
#	pyrogram/client/dispatcher/dispatcher.py
2018-04-30 10:30:34 +02:00
JosXa
bb607e56be Added locks for modifying and iterating handlers
Added `remove_handler` method
Made `add_handler` return a (handler, group) tuple
2018-04-30 00:15:24 +02:00
Dan
33c417942c Clear thread lists when stopping. Related to #62 2018-04-29 20:20:34 +02:00
Dan
b8996b1147 Remove chat field for now, it can be accessed via message.chat 2018-04-29 17:29:48 +02:00
Dan
9c7935702f Add callback query support 2018-04-28 23:48:38 +02:00
Dan
489bd4ac38 Remove message_parser, move all functions in utils 2018-04-28 09:38:07 +02:00
Dan
6e78935857 Accommodate the new types 2018-04-24 16:08:33 +02:00
Dan
0dd5ebef80 Fix raw update handler throwing errors 2018-04-14 16:59:34 +02:00
Dan
17259d1b7b Join threads before closing the connection 2018-04-13 19:09:00 +02:00
Dan
472ed8e355 Document the new features 2018-04-11 03:16:48 +02:00
Dan
c33c7c76fd Rework dispatcher 2018-04-10 14:52:31 +02:00
Dan
fb4e98b0b5 Evaluate filters before dispatching messages 2018-04-09 23:35:51 +02:00