示例#1
0
    def del_section(message):
        try:
            conn = sqlite3.connect("base_ts.sqlite")
            cursor = conn.cursor()
            cursor.execute('SELECT * FROM catalog')
            row = cursor.fetchall()
            cursor.close()
            conn.close()

            name = row[int(message.text)][1]
            nm = row[int(message.text)][0]
            num_catalog = func.Catalog(name)
            catalog_dict[message.chat.id] = num_catalog

            markup = types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
            markup.add('Yes', 'No')

            msg = bot.send_message(chat_id=message.chat.id,
                                   text=f'{nm}\nУдалить этот каталог?',
                                   reply_markup=markup)

            bot.register_next_step_handler(msg, del_section_2)
        except Exception as e:
            bot.send_message(chat_id=message.chat.id,
                             text='Упсс, что-то пошло не по плану')
示例#2
0
 def create_section(message):
     try:
         name = message.text
         catalog = func.Catalog(name)
         catalog_dict[message.chat.id] = catalog
         msg = bot.send_message(chat_id=message.chat.id,
                                text=name + '\n\n Создать?',
                                reply_markup=menu.markup)
         bot.register_next_step_handler(msg, create_section_2)
     except Exception as e:
         bot.send_message(chat_id=message.chat.id,
                          text='⚠️ Что-то пошло не по плану',
                          reply_markup=menu.admin_menu)
示例#3
0
 def create_section(message):
     try:
         name = message.text
         catalog = func.Catalog(name)
         catalog_dict[message.chat.id] = catalog
         markup = types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
         markup.add('Yes', 'No')
         msg = bot.send_message(chat_id=message.chat.id,
                                text=name + '\n\n Создать?',
                                reply_markup=markup)
         bot.register_next_step_handler(msg, create_section_2)
     except Exception as e:
         bot.send_message(chat_id=message.chat.id,
                          text='⚠️ Что-то пошло не по плану',
                          reply_markup=menu.main_menu)