MCPcopy
hub / github.com/Gozargah/Marzban / edit_note_command

Function edit_note_command

app/telegram/handlers/admin.py:588–603  ·  view source on GitHub ↗
(call: types.CallbackQuery)

Source from the content-addressed store, hash-verified

586
587@bot.callback_query_handler(cb_query_startswith('edit_note:'), is_admin=True)
588def 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
606def edit_note_step(message: types.Message):

Callers

nothing calls this directly

Calls 5

GetDBClass · 0.90
schedule_delete_messageFunction · 0.85
cleanup_messagesFunction · 0.85
inline_cancel_actionMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected