From a243ddcac88291f1abd3713f53795c33755284e7 Mon Sep 17 00:00:00 2001 From: machka-pasla Date: Thu, 11 Sep 2025 23:05:57 +0300 Subject: [PATCH] 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. --- bot/handlers/admin/ads.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bot/handlers/admin/ads.py b/bot/handlers/admin/ads.py index b9d38d5..33bd539 100644 --- a/bot/handlers/admin/ads.py +++ b/bot/handlers/admin/ads.py @@ -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