@@ -140,18 +140,17 @@ async def check(self, client: "pyrogram.Client", query: CallbackQuery):
140140 else :
141141 handler_does_match = True
142142
143- if PyromodConfig .unallowed_click_alert and listener :
143+ if PyromodConfig .unallowed_click_alert and listener and not listener_does_match :
144144 data = self .compose_data_identifier (query )
145145 permissive_identifier = Identifier (
146- chat_id = data .chat_id ,
147- message_id = data .message_id ,
148- inline_message_id = data .inline_message_id ,
146+ chat_id = listener . identifier .chat_id ,
147+ message_id = listener . identifier .message_id ,
148+ inline_message_id = listener . identifier .inline_message_id ,
149149 from_user_id = None ,
150150 )
151151
152152 if (
153153 permissive_identifier .matches (data )
154- and not listener_does_match
155154 and listener .unallowed_click_alert
156155 ):
157156 alert = (
@@ -188,18 +187,17 @@ async def resolve_future_or_callback(
188187 try :
189188 listener .future .set_result (query )
190189 except asyncio .CancelledError :
191- # Future cancelled during shutdown; stop propagation silently
192190 raise pyrogram .StopPropagation
193-
194191 raise pyrogram .StopPropagation
192+ elif listener .future and listener .future .done ():
193+ await self .original_callback (client , query , * args )
195194 elif listener .callback :
196195 try :
197196 await utils .invoke_callable (listener .callback , client , query , * args )
198197 except asyncio .CancelledError :
199198 raise pyrogram .StopPropagation
200-
201199 raise pyrogram .StopPropagation
202200 else :
203- raise ValueError ( "Listener must have either a future or a callback" )
201+ await self . original_callback ( client , query , * args )
204202 else :
205203 await self .original_callback (client , query , * args )
0 commit comments