themes = {}
@bot.message_handler(commands=["post"])
def post(m):
msg = bot.send_message(
m.chat.id, "Какую тему хотите опубликовать?", reply_markup=telebot.types.ReplyKeyboardMarkup(True, True).row("Тема 1",'Тема 2'))
bot.register_next_step_handler(msg, post_choice)
def post_choice(m):
if m.text == "Тема 1":
themes[
m.chat.id] = 1
elif m.text == "Тема 2":
themes[
m.chat.id] = 2
else:
msg = bot.send_message(
m.chat.id, "выбрана Не верная тема!", reply_markup=telebot.types.ReplyKeyboardMarkup(True, True).row("Тема 1",'Тема 2'))
bot.register_next_step_handler(msg, post_choice)
return
bot.send_message(
m.chat.id, "вы выбрали тему: "+m.text, reply_markup=telebot.types.ReplyKeyboardRemove())
@bot.message_handler(content_types=["photo", "video", "document"])
def fwd(m):
theme = themes.get(
m.chat.id)
if not theme:
msg = bot.send_message(
m.chat.id, "Перед отправкой выбери тему!", reply_markup=telebot.types.ReplyKeyboardMarkup(True, True).row("Тема 1",'Тема 2'))
bot.register_next_step_handler(msg, post_choice)
return
if theme == 1:
bot.send_message(
m.chat.id, "Пост на тему 1 отправлен на рассмотрение")
...
if theme == 2:
bot.send_message(
m.chat.id, "Пост на тему 2 отправлен на рассмотрение")
...