@@ -106,7 +106,7 @@ def _create_session_with_retry():
106106 session .mount ("https://" , adapter )
107107 return session
108108
109- def send_photo (token : str , chat_id : str , photo_path : str , caption : str = "" , reply_markup : Optional [dict ] = None ) -> bool :
109+ def send_photo (token : str , chat_id : str , photo_path : str , caption : str = "" , reply_markup : Optional [dict ] = None , disable_notification : bool = False ) -> bool :
110110 for attempt in range (3 ):
111111 try :
112112 url = f"https://api.telegram.org/bot{ token } /sendPhoto"
@@ -118,7 +118,7 @@ def send_photo(token: str, chat_id: str, photo_path: str, caption: str = "", rep
118118 else :
119119 files = {'photo' : open (photo_path , 'rb' )}
120120
121- data = {'chat_id' : chat_id , 'caption' : caption }
121+ data = {'chat_id' : chat_id , 'caption' : caption , 'disable_notification' : disable_notification }
122122 if reply_markup : data ['reply_markup' ] = json .dumps (reply_markup )
123123
124124 response = session .post (url , files = files , data = data , timeout = 30 )
@@ -394,11 +394,21 @@ def _setup_handlers(self):
394394 self .app .add_handler (MessageHandler (filters .TEXT & ~ filters .COMMAND , self .handlers .message_listener ))
395395 self .app .add_handler (CallbackQueryHandler (self .handlers .button_callback_handler ))
396396
397- def schedule_alert (self , chat_id : str , image_path : str , caption : str , alert_id : str , is_fire : bool = False ):
397+ def schedule_alert (self , chat_id : str , image_path : str , caption : str , alert_id : str , is_fire : bool = False , disable_notification : bool = False ):
398398 if not TELEGRAM_AVAILABLE : return
399399 kb = create_fire_alert_keyboard (alert_id ) if is_fire else create_person_alert_keyboard (alert_id )
400400 markup = kb .to_dict () if kb else None
401- threading .Thread (target = lambda : send_photo (settings .telegram .token , chat_id , image_path , caption , reply_markup = markup ), daemon = True ).start ()
401+ threading .Thread (
402+ target = lambda : send_photo (
403+ settings .telegram .token ,
404+ chat_id ,
405+ image_path ,
406+ caption ,
407+ reply_markup = markup ,
408+ disable_notification = disable_notification
409+ ),
410+ daemon = True
411+ ).start ()
402412
403413 def schedule_person_alert (self , chat_id : str , image_path : str , caption : str , alert_id : str ):
404414 """Schedules a person alert. Alias for schedule_alert with is_fire=False."""
0 commit comments