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:
@@ -169,9 +169,9 @@ async def ads_delete_cancel(callback: types.CallbackQuery, settings: Settings, i
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_, _, _, camp_id_str, back_page_str = callback.data.split(":", 4)
|
parts = callback.data.split(":", 3)
|
||||||
camp_id = int(camp_id_str)
|
camp_id = int(parts[2])
|
||||||
back_page = int(back_page_str)
|
back_page = int(parts[3])
|
||||||
except Exception:
|
except Exception:
|
||||||
await callback.answer(_("error_try_again"), show_alert=True)
|
await callback.answer(_("error_try_again"), show_alert=True)
|
||||||
return
|
return
|
||||||
@@ -215,9 +215,9 @@ async def ads_delete_confirm(callback: types.CallbackQuery, settings: Settings,
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_, _, _, camp_id_str, back_page_str = callback.data.split(":", 4)
|
parts = callback.data.split(":", 3)
|
||||||
camp_id = int(camp_id_str)
|
camp_id = int(parts[2])
|
||||||
back_page = int(back_page_str)
|
back_page = int(parts[3])
|
||||||
except Exception:
|
except Exception:
|
||||||
await callback.answer(_("error_try_again"), show_alert=True)
|
await callback.answer(_("error_try_again"), show_alert=True)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user