(call: types.CallbackQuery)
| 586 | |
| 587 | @bot.callback_query_handler(cb_query_startswith('edit_note:'), is_admin=True) |
| 588 | def edit_note_command(call: types.CallbackQuery): |
| 589 | username = call.data.split(':')[1] |
| 590 | with GetDB() as db: |
| 591 | db_user = crud.get_user(db, username) |
| 592 | if not db_user: |
| 593 | return bot.answer_callback_query(call.id, '❌ User not found.', show_alert=True) |
| 594 | schedule_delete_message(call.message.chat.id, call.message.id) |
| 595 | cleanup_messages(call.message.chat.id) |
| 596 | msg = bot.send_message( |
| 597 | call.message.chat.id, |
| 598 | f'<b>📝 Current Note:</b> <code>{db_user.note}</code>\n\nSend new Note for <code>{username}</code>', |
| 599 | parse_mode="HTML", |
| 600 | reply_markup=BotKeyboard.inline_cancel_action(f'user:{username}')) |
| 601 | mem_store.set(f'{call.message.chat.id}:username', username) |
| 602 | schedule_delete_message(call.message.chat.id, msg.id) |
| 603 | bot.register_next_step_handler(msg, edit_note_step) |
| 604 | |
| 605 | |
| 606 | def edit_note_step(message: types.Message): |
nothing calls this directly
no test coverage detected