Answer the question
In order to leave comments, you need to log in
Why is bot.register_next_step_handler not working?
The code should send a message
Enter *percentage* you want to setand wait for the percentage itself, but he does not survive anything and instead of the percentage sets just the same message that he himself sent
Enter *percentage* you want to setHow to solve it?
def izmproc(call, user_type, user_id):
global a1
a1 = user_id
mess = database.с_message(user_id)
code = database.c_code(user_id)
chat_id = call.message.chat.id
code2 = str(chat_id)[:5]
with sqlite3.connect("evidence.db") as con:
cur = con.cursor()
result = cur.execute('SELECT * FROM `c` WHERE `id` = ?', (user_id,)).fetchall()
for row in result:
username2 = repl(row[3])
try:
if (code2 == code) or (call.message.chat.id == support) or (call.message.chat.id == admin):
message = bot.send_message(chat_id, f" Введите *процент* который хотите установить [{row[4]}](https://t.me/{row[3]})", parse_mode="Markdown", disable_web_page_preview=True)
bot.register_next_step_handler(message, proc_c(call, a1))
except Exception as e:
print(e)
def proc_c(call, argument):
user_id = argument
mess = database.c_message(user_id)
code = database.c_code(user_id)
chat_id = call.message.chat.id
code2 = str(chat_id)[:5]
try:
if (code2 == code) or (call.message.chat.id == support) or (call.message.chat.id == admin):
result = database.user_update_f(user_id, call.message.text)
if (result == 1):
bot.send_message(call.message.chat.id, f' Процент *изменен*\nНовый процент: {database.user_f(user_id)}', parse_mode="Markdown")
if (result == 2):
bot.send_message(call.message.chat.id, f' *Ошибка*', parse_mode="Markdown")
else:
bot.send_message(call.message.chat.id, f' *Ошибка*', parse_mode="Markdown")
except Exception as e:
print(e)
Answer the question
In order to leave comments, you need to log in
bot.register_next_step_handler(message, proc_c(call, a1))
bot.register_next_step_handler(message, proc_c, call, a1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question