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

Function add_data_step

app/telegram/handlers/admin.py:251–268  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

249
250
251def add_data_step(message):
252 try:
253 data_limit = float(message.text)
254 if not data_limit:
255 raise ValueError
256 except ValueError:
257 wait_msg = bot.send_message(message.chat.id, '❌ Data limit must be a number and not zero.')
258 schedule_delete_message(message.chat.id, wait_msg.message_id)
259 return bot.register_next_step_handler(wait_msg, add_data_step)
260 schedule_delete_message(message.chat.id, message.message_id)
261 msg = bot.send_message(
262 message.chat.id,
263 f"⚠️ Are you sure? this will change Data limit of all users according to <b>"
264 f"{'+' if data_limit > 0 else '-'}{readable_size(abs(data_limit * 1024*1024*1024))}</b>",
265 parse_mode="html",
266 reply_markup=BotKeyboard.confirm_action('add_data', data_limit))
267 cleanup_messages(message.chat.id)
268 schedule_delete_message(message.chat.id, msg.id)
269
270
271@bot.callback_query_handler(cb_query_equals('add_time'), is_admin=True)

Callers

nothing calls this directly

Calls 4

readable_sizeFunction · 0.90
schedule_delete_messageFunction · 0.85
cleanup_messagesFunction · 0.85
confirm_actionMethod · 0.80

Tested by

no test coverage detected