2323from threading import Thread , Lock
2424
2525import pyrogram
26- from pyrogram .api import types
26+ from pyrogram .api .types import (
27+ UpdateNewMessage , UpdateNewChannelMessage , UpdateNewScheduledMessage ,
28+ UpdateEditMessage , UpdateEditChannelMessage ,
29+ UpdateDeleteMessages , UpdateDeleteChannelMessages ,
30+ UpdateBotCallbackQuery , UpdateInlineBotCallbackQuery ,
31+ UpdateUserStatus , UpdateBotInlineQuery , UpdateMessagePoll
32+ )
2733from . import utils
2834from ..handlers import (
2935 CallbackQueryHandler , MessageHandler , DeletedMessagesHandler ,
3541
3642class Dispatcher :
3743 NEW_MESSAGE_UPDATES = (
38- types .UpdateNewMessage ,
39- types .UpdateNewChannelMessage
44+ UpdateNewMessage ,
45+ UpdateNewChannelMessage ,
46+ UpdateNewScheduledMessage
4047 )
4148
4249 EDIT_MESSAGE_UPDATES = (
43- types . UpdateEditMessage ,
44- types . UpdateEditChannelMessage
50+ UpdateEditMessage ,
51+ UpdateEditChannelMessage ,
4552 )
4653
4754 DELETE_MESSAGES_UPDATES = (
48- types . UpdateDeleteMessages ,
49- types . UpdateDeleteChannelMessages
55+ UpdateDeleteMessages ,
56+ UpdateDeleteChannelMessages
5057 )
5158
5259 CALLBACK_QUERY_UPDATES = (
53- types . UpdateBotCallbackQuery ,
54- types . UpdateInlineBotCallbackQuery
60+ UpdateBotCallbackQuery ,
61+ UpdateInlineBotCallbackQuery
5562 )
5663
5764 MESSAGE_UPDATES = NEW_MESSAGE_UPDATES + EDIT_MESSAGE_UPDATES
@@ -68,21 +75,30 @@ def __init__(self, client, workers: int):
6875
6976 self .update_parsers = {
7077 Dispatcher .MESSAGE_UPDATES :
71- lambda upd , usr , cht : (pyrogram .Message ._parse (self .client , upd .message , usr , cht ), MessageHandler ),
78+ lambda upd , usr , cht : (
79+ pyrogram .Message ._parse (
80+ self .client ,
81+ upd .message ,
82+ usr ,
83+ cht ,
84+ isinstance (upd , UpdateNewScheduledMessage )
85+ ),
86+ MessageHandler
87+ ),
7288
7389 Dispatcher .DELETE_MESSAGES_UPDATES :
7490 lambda upd , usr , cht : (utils .parse_deleted_messages (self .client , upd ), DeletedMessagesHandler ),
7591
7692 Dispatcher .CALLBACK_QUERY_UPDATES :
7793 lambda upd , usr , cht : (pyrogram .CallbackQuery ._parse (self .client , upd , usr ), CallbackQueryHandler ),
7894
79- (types . UpdateUserStatus ,):
95+ (UpdateUserStatus ,):
8096 lambda upd , usr , cht : (pyrogram .User ._parse_user_status (self .client , upd ), UserStatusHandler ),
8197
82- (types . UpdateBotInlineQuery ,):
98+ (UpdateBotInlineQuery ,):
8399 lambda upd , usr , cht : (pyrogram .InlineQuery ._parse (self .client , upd , usr ), InlineQueryHandler ),
84100
85- (types . UpdateMessagePoll ,):
101+ (UpdateMessagePoll ,):
86102 lambda upd , usr , cht : (pyrogram .Poll ._parse_update (self .client , upd ), PollHandler )
87103 }
88104
0 commit comments