Oct 17 11:16:16 vps1707806210 systemd[1]: Started My SMS Bot Service. Oct 17 11:16:19…
- User
Oct 17 11:16:16 vps1707806210 systemd[1]: Started My SMS Bot Service. Oct 17 11:16:19 vps1707806210 python[16573]: Traceback (most recent call last): Oct 17 11:16:19 vps1707806210 python[16573]: File "/root/sms/main.py", line 8, in Oct 17 11:16:19 vps1707806210 python[16573]: from bot.handlers import register_handlers Oct 17 11:16:19 vps1707806210 python[16573]: File "/root/sms/bot/handlers/init.py", line 9, in Oct 17 11:16:19 vps1707806210 python[16573]: from .activation import register_activation_handlers Oct 17 11:16:19 vps1707806210 python[16573]: File "/root/sms/bot/handlers/activation.py", line 19, in Oct 17 11:16:19 vps1707806210 python[16573]: async def current_activations_handler(callback_query: types.CallbackQuery, state: FSMContext): Oct 17 11:16:19 vps1707806210 python[16573]: NameError: name 'FSMContext' is not defined Oct 17 11:16:20 vps1707806210 systemd[1]: my_smsbot.service: Main process exited, code=exited, status=1/FAILURE Oct 17 11:16:20 vps1707806210 systemd[1]: my_smsbot.service: Failed with result 'exit-code'. Oct 17 11:16:20 vps1707806210 systemd[1]: my_smsbot.service: Consumed 4.141s CPU time. Oct 17 11:16:20 vps1707806210 systemd[1]: my_smsbot.service: Scheduled restart job, restart counter is at 37. Oct 17 11:16:20 vps1707806210 systemd[1]: Stopped My SMS Bot Service. Oct 17 11:16:20 vps1707806210 systemd[1]: my_smsbot.service: Consumed 4.141s CPU time. Oct 17 11:16:20 vps1707806210 systemd[1]: Started My SMS Bot Service.
bot/handlers/activation.py
import logging from aiogram import Dispatcher, types, F from aiogram.utils.keyboard import InlineKeyboardBuilder
from ..data import ( get_user_api_key, get_activations_by_user, get_activation, update_activation_status, delete_activation ) from ..api import SmsHubAPI from ..utils import safe_edit_or_send_message
logger = logging.getLogger(name)
async def current_activations_handler(callback_query: types.CallbackQuery, state: FSMContext): user_id = callback_query.from_user.id await callback_query.answer()
activations = await get_activations_by_user(user_id) if not activations: keyboard = InlineKeyboardBuilder() keyboard.button(text="🔙 Назад", callback_data="back_to_main_menu") keyboard.adjust(1) await safe_edit_or_send_message( message=callback_query.message, new_text="У вас нет активных активаций.", state=state, reply_markup=keyboard.as_markup() ) return keyboard = InlineKeyboardBuilder() for activation_id, details in activations.items(): service = details.get("service", "Неизвестно") number = details.get("number", "Неизвестно") status = details.get("status", "Неизвестно") keyboard.button( text=f"{service} ({number}) - {status}", callback_data=f"manage_activation:{activation_id}" ) keyboard.row() keyboard.button(text="🔙 Назад", callback_data="back_to_main_menu") keyboard.adjust(1) await safe_edit_or_send_message( message=callback_query.message, new_text="Ваши текущие активации:", state=state, reply_markup=keyboard.as_markup() ) - Assistant