Answer the question
In order to leave comments, you need to log in
Trouble with Telebot Python?
I'm trying to make my Telegram bot so that the admin can transfer money to users on the profile balance, but I don't know how to implement it...
Yes, I'll start by asking for the user id:
msg = bot.send_message(message.chat.id, " Enter user ID:")
bot.register_next_step_handler(msg, give_money)
I don't know how to do it next, because I now need to know the amount that the admin wants to transfer, but not lose the value of the user ID.
Answer the question
In order to leave comments, you need to log in
In the same way, give_money()
send a message in the function asking you to deposit an amount, add bot.register_next_step_handler() to the same message, the first argument is the message, the second is the next function, and then *args
or **kwargs
. So you can just pass the user ID as the third argument
def give_money(message):
user_id = message.text
msg = bot.send_message(message.chat.id, " Введите сумму:")
bot.register_next_step_handler(msg, send_money, user_id)
def send_money(message, user_id):
# ну и тут сумма в message.text, а id в user_id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question