Refactor ads deletion callback data parsing to improve clarity and maintainability. Updated the way campaign ID and back page are extracted from the callback data.

This commit is contained in:
machka-pasla
2025-09-11 23:05:57 +03:00
parent 357d7caf26
commit a243ddcac8
+6 -6
View File
@@ -169,9 +169,9 @@ async def ads_delete_cancel(callback: types.CallbackQuery, settings: Settings, i
return
try:
_, _, _, camp_id_str, back_page_str = callback.data.split(":", 4)
camp_id = int(camp_id_str)
back_page = int(back_page_str)
parts = callback.data.split(":", 3)
camp_id = int(parts[2])
back_page = int(parts[3])
except Exception:
await callback.answer(_("error_try_again"), show_alert=True)
return
@@ -215,9 +215,9 @@ async def ads_delete_confirm(callback: types.CallbackQuery, settings: Settings,
return
try:
_, _, _, camp_id_str, back_page_str = callback.data.split(":", 4)
camp_id = int(camp_id_str)
back_page = int(back_page_str)
parts = callback.data.split(":", 3)
camp_id = int(parts[2])
back_page = int(parts[3])
except Exception:
await callback.answer(_("error_try_again"), show_alert=True)
return