def rgb(message):
msg = bot.send_message(chat_id, 'введите rgbmin')
bot.register_next_step_handler(msg, rgbmin)
def rgbmin(message):
ur = user_rgbmin = message.text
If ur > 255 or ur < 0:
msg = bot.send_message(chat_id, 'rgbmin должен быть в интервале от 0 до 255, введите ещё раз')
bot.register_next_step_handler(msg, rgbmin)
return
msg = bot.send_message(chat_id, 'введите rgbmax')
bot.register_next_step_handler(msg, rgbmax)
def rgbmax(message):
‘Аналогично def rgbmin(message)
...
def question(message):
keyboard = types.InlineKeyboardMarkup(row_width=2)
a = types.InlineKeyboardButton(text="Ответ", callback_data="get_answer")
keyboard.add(a)
bot.send_message(chat_id, "Вопрос", reply_markup = keyboard)
@bot.callback_query_handler(func=lambda call: call.data == 'get_answer') #call: call.data == 'some_data'
def callback_get_answer(call):
if call.message:
bot.send_message(chat_id, "Ответ", reply_markup = "")
@bot.message_handler(regexp="Зашифровать")
def send_text(message):
msg = bot.send_message(message.chat.id, 'Пришлите файл для зашифровки')
bot.register_next_step_handler(msg, handle_file)
def handle_file(message):
try:
file_info = bot.get_file(message.document.file_id)
downloaded_file = bot.download_file(file_info.file_path)
src = 'D:' + message.document.file_name;
filename = message.document.file_name
return filename
with open(src, 'wb') as new_file:
new_file.write(downloaded_file)
bot.reply_to(message, "Шифрую...")
except Exception as e:
bot.reply_to(message, e)