Answer the question
In order to leave comments, you need to log in
Error: not found c. How to solve problems?
The code:
@bot.callback_query_handler(lambda c: c.data == "aim_confirm")
def aim_confirm(update, c):
global numbers
userID = c.from_user.id # ID пользователя
chatID = c.message.chat.id # ID чата с пользователем
query = update.callback_query
try:
if numbers != []:
amount = int(''.join(map(str, numbers)))
numbers = []
db.changeaim(userID, amount)
bot.edit_message_text('*Успешно*', c.message.chat.id, c.message.id,
parse_mode='Markdown',
reply_markup=InlineKeyboardMarkup(ib.back))
else:
bot.answer_callback_query(callback_query_id=query.id, text = 'Введите число!', show_alert=True)
except Error as err:
print(err)
Traceback (most recent call last):
File "C:\Users\sasha\Desktop\проекты\финансист (открыто)\код2.0\bot.py", line 330, in <module>
bot.polling()
File "C:\Users\sasha\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 619, in polling
self.__threaded_polling(none_stop, interval, timeout, long_polling_timeout, allowed_updates)
File "C:\Users\sasha\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 678, in __threaded_polling
raise e
File "C:\Users\sasha\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 641, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\sasha\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\util.py", line 130, in raise_exceptions
raise self.exception_info
File "C:\Users\sasha\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\util.py", line 82, in run
task(*args, **kwargs)
TypeError: aim_confirm() missing 1 required positional argument: 'c'
Answer the question
In order to leave comments, you need to log in
It is necessary to remove update
and instead callback_query_id=query.id
write callback_query_id=с.id
, but query = update.callback_query
remove.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question