Exemple #1
0
    def handler_call(call):
        chat_id = call.message.chat.id
        message_id = call.message.message_id

        # Main menu
        if call.data == 'edit_price':
            msg = bot.send_message(
                chat_id=chat_id,
                text=f'Выберите каталог:\n{func.edit_price_list_c()}')

            bot.register_next_step_handler(msg, edit_price)

        if '🇷🇺' in call.data or '🇺🇦' in call.data or '🇰🇿' in call.data:
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text=f'Добро пожаловать в меню, вы выбрали город {call.data}',
                reply_markup=menu.main_menu)

        if call.data in 'ruuakz':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Выберите город',
                                  reply_markup=func.cities(call.data))

        if call.data == 'catalog':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Каталог',
                                  reply_markup=func.menu_catalog())

        if call.data == 'exit_from_catalog':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы вернулись назад',
                                  reply_markup=menu.main_menu)

        if call.data == 'admin_address':
            bot.send_message(chat_id=chat_id,
                             text=func.admin_address(),
                             reply_markup=menu.to_close)

        if call.data in func.list_sections():
            name = call.data
            product = func.Product(chat_id)
            product_dict[call.message.chat.id] = product
            product.section = name

            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text=f'❕ Выберите нужный товар',
                                  reply_markup=func.menu_section(call.data))

        if call.data in func.list_product():
            product = func.Product(chat_id)
            product_dict[chat_id] = product
            product = product_dict[chat_id]

            info = func.menu_product(call.data, product)
            product.product = info[1].product
            product.section = info[1].section
            product.amount_MAX = info[1].amount_MAX
            product.price = info[1].price

            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text=info[0],
                                  reply_markup=menu.btn_purchase)

        try:
            if call.data == 'buy':
                product = product_dict[chat_id]
                msg = bot.send_message(
                    chat_id=chat_id,
                    text=f'❕ Введите кол-во товара\n❕ От 1 - 15')
                bot.register_next_step_handler(msg, buy)
        except:
            pass

        try:
            if call.data == 'info':
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text=settings.info,
                                      reply_markup=menu.main_menu)
        except:
            pass

        if call.data == 'exit_to_menu':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы вернулись в главное меню',
                                  reply_markup=menu.main_menu)

        if call.data == 'btn_ok':
            bot.delete_message(chat_id, message_id)

        try:
            if call.data == 'profile':
                info = func.profile(chat_id)
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text=settings.profile.format(
                                          id=info[0],
                                          login=f'@{info[1]}',
                                          data=info[2][:19],
                                          balance=info[5]),
                                      reply_markup=menu.main_menu)
        except:
            pass

        # Admin menu
        try:
            if call.data == 'admin_info':
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text=func.admin_info(),
                                      reply_markup=menu.admin_menu)
        except:
            pass

        if call.data == 'add_section_to_catalog':
            if chat_id == settings.admin_id:
                msg = bot.send_message(chat_id=chat_id,
                                       text='Введите название раздела')
                bot.register_next_step_handler(msg, create_section)

        if call.data == 'del_section_to_catalog':
            if chat_id == settings.admin_id:
                conn = sqlite3.connect("base_ts.sqlite")
                cursor = conn.cursor()
                cursor.execute('SELECT * FROM catalog')
                row = cursor.fetchall()
                cursor.close()
                conn.close()

                text = ''
                num = 0

                for i in row:
                    text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                    num += 1

                msg = bot.send_message(chat_id=chat_id,
                                       text='Введите номер раздела\n\n'
                                       f'{text}')
                bot.register_next_step_handler(msg, del_section)

        if call.data == 'add_product_to_section':
            if chat_id == settings.admin_id:
                conn = sqlite3.connect("base_ts.sqlite")
                cursor = conn.cursor()
                cursor.execute('SELECT * FROM catalog')
                row = cursor.fetchall()

                text = ''
                num = 0

                for i in row:
                    text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                    num += 1

                msg = bot.send_message(
                    chat_id=chat_id,
                    text=
                    'Введите номер раздела в которы вы хотите добавить товар\n\n'
                    f'{text}')
                bot.register_next_step_handler(msg, create_product)

        if call.data == 'del_product_to_section':
            if chat_id == settings.admin_id:
                conn = sqlite3.connect("base_ts.sqlite")
                cursor = conn.cursor()
                cursor.execute('SELECT * FROM catalog')
                row = cursor.fetchall()

                text = ''
                num = 0

                for i in row:
                    text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                    num += 1

                msg = bot.send_message(
                    chat_id=chat_id,
                    text=
                    'Введите номер раздела из которого вы хотите удалить товар\n\n'
                    f'{text}')
                bot.register_next_step_handler(msg, del_product)

        if call.data == 'download_product':
            conn = sqlite3.connect("base_ts.sqlite")
            cursor = conn.cursor()
            cursor.execute('SELECT * FROM catalog')
            row = cursor.fetchall()

            text = ''
            num = 0

            for i in row:
                text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                num += 1

            msg = bot.send_message(chat_id=chat_id,
                                   text='Введите номер раздела\n\n'
                                   f'{text}')
            bot.register_next_step_handler(msg, download_product)

        if call.data == 'exit_admin_menu':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы покинули меню админа',
                                  reply_markup=menu.main_menu)

        if call.data == 'back_to_admin_menu':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы перешли в меню админа',
                                  reply_markup=menu.admin_menu)

        if call.data == 'catalog_control':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы перешли в управление каталогом',
                                  reply_markup=menu.admin_menu_control_catalog)

        if call.data == 'section_control':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы перешли в управление разделами',
                                  reply_markup=menu.admin_menu_control_section)

        if call.data == 'replenish_balance':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text=func.replenish_balance(chat_id),
                                  reply_markup=menu.replenish_balance)

        if call.data == 'cancel_payment':
            func.cancel_payment(chat_id)
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='❕ Добро пожаловать!',
                                  reply_markup=menu.main_menu)

        if call.data == 'check_payment':
            check = func.check_payment(chat_id)
            if check[0] == 1:
                bot.edit_message_text(
                    chat_id=chat_id,
                    message_id=message_id,
                    text=f'✅ Оплата прошла\nСумма - {check[1]} тенге',
                    reply_markup=menu.main_menu)

                bot.send_message(
                    chat_id=settings.admin_id,
                    text='💰 Пополнение баланса\n'
                    f'🔥 От - {chat_id}/{call.message.from_user.username}/{call.message.from_user.first_name}\n'
                    f'🔥 Сумма - {check[1]} тенге')

                try:
                    bot.send_message(
                        chat_id=f'-100{settings.CHANNEL_ID}',
                        text='💰 Пополнение баланса\n'
                        f'🔥 Бот пренадлежит - {settings.LOGIN_ADMIN}'
                        f'🔥 От - {chat_id}/{call.message.from_user.username}/{call.message.from_user.first_name}\n'
                        f'🔥 Сумма - {check[1]} тенге')
                except:
                    pass

            if check[0] == 0:
                bot.send_message(chat_id=chat_id,
                                 text='❌ Оплата не найдена',
                                 reply_markup=menu.to_close)

        if call.data == 'to_close':
            bot.delete_message(chat_id=chat_id, message_id=message_id)

        if call.data == 'give_balance':
            msg = bot.send_message(
                chat_id=chat_id,
                text='Введите id человека, которому будет изменён баланс')

            bot.register_next_step_handler(msg, give_balance)

        if call.data == 'admin_sending_messages':
            msg = bot.send_message(chat_id, text='Введите текст рассылки')
            bot.register_next_step_handler(msg, admin_sending_messages)
Exemple #2
0
    def handler_call(call):
        chat_id = call.message.chat.id
        message_id = call.message.message_id

        # Main menu
        if call.data == 'catalog':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text='Каталог',
                reply_markup=func.menu_catalog()
            )

        if call.data == 'exit_from_catalog':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text='Вы вернулись назад',
                reply_markup=menu.main_menu
            )


        if call.data in func.list_sections():
            name = call.data
            product = func.Product(chat_id)
            product_dict[call.message.chat.id] = product
            product.section = name

            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text=f'❕ Выберите нужный товар',
                reply_markup=func.menu_section(call.data)
            )

        if call.data in func.list_product():
            conn = sqlite3.connect("base_ts.sqlite")
            cursor = conn.cursor()
            cursor.execute(f'SELECT * FROM "{call.data}"')
            row = cursor.fetchall()
            if len(row) > 0:
                product = func.Product(chat_id)
                product_dict[chat_id] = product
                product = product_dict[chat_id]

                info = func.menu_product(call.data, product)
                product.product = info[1].product
                product.section = info[1].section
                product.amount_MAX = info[1].amount_MAX
                product.price = info[1].price

                bot.edit_message_text(
                    chat_id=chat_id,
                    message_id=message_id,
                    text=info[0],
                    reply_markup=menu.btn_purchase
                )

            if len(row) == 0:
                bot.edit_message_text(
                    chat_id=chat_id,
                    message_id=message_id,
                    text='Товар закончился, напишите в тех. поддержку',
                    reply_markup=menu.main_menu
                )

        if call.data == 'buy':
            product = product_dict[chat_id]
            msg = bot.send_message(chat_id=chat_id,
                                   text=f'❕ Введите кол-во товара\n❕ От 1 - {product.amount_MAX}')
            bot.register_next_step_handler(msg, buy)

        if call.data == 'info':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text=settings.info,
                reply_markup=menu.main_menu
            )

        if call.data == 'purchases':
            msg = func.basket(chat_id)
            if len(msg) > 0:
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text=msg,
                                      reply_markup=menu.main_menu)
            if len(msg) == 0:
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text='У вас нет покупок 😢',
                                      reply_markup=menu.main_menu)


        if call.data == 'exit_to_menu':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text='Вы вернулись в главное меню',
                reply_markup=menu.main_menu
            )

        if call.data == 'btn_ok':
            bot.delete_message(chat_id, message_id)

        if call.data == 'profile':
            info = func.profile(chat_id)
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text=settings.profile.format(
                                      id=info[0],
                                      login=f'@{info[1]}',
                                      data=info[2][:19],
                                      balance=info[5]
                                  ),
                                  reply_markup=menu.main_menu)

        # Admin menu
        if call.data == 'admin_info':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text=func.admin_info(),
                reply_markup=menu.admin_menu
            )

        if call.data == 'add_section_to_catalog':
            if chat_id == settings.admin_id:
                msg = bot.send_message(chat_id=chat_id,
                                       text='Введите название раздела')
                bot.register_next_step_handler(msg, create_section)

        if call.data == 'del_section_to_catalog':
            if chat_id == settings.admin_id:
                conn = sqlite3.connect("base_ts.sqlite")
                cursor = conn.cursor()
                cursor.execute('SELECT * FROM catalog')
                row = cursor.fetchall()
                cursor.close()
                conn.close()

                text = ''
                num = 0

                for i in row:
                    text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                    num += 1

                msg = bot.send_message(
                    chat_id=chat_id,
                    text='Введите номер раздела\n\n'
                         f'{text}'
                )
                bot.register_next_step_handler(msg, del_section)

        if call.data == 'add_product_to_section':
            if chat_id == settings.admin_id:
                conn = sqlite3.connect("base_ts.sqlite")
                cursor = conn.cursor()
                cursor.execute('SELECT * FROM catalog')
                row = cursor.fetchall()

                text = ''
                num = 0

                for i in row:
                    text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                    num += 1

                msg = bot.send_message(chat_id=chat_id,
                                       text='Введите номер раздела в которы вы хотите добавить товар\n\n'
                                            f'{text}')
                bot.register_next_step_handler(msg, create_product)

        if call.data == 'del_product_to_section':
            if chat_id == settings.admin_id:
                conn = sqlite3.connect("base_ts.sqlite")
                cursor = conn.cursor()
                cursor.execute('SELECT * FROM catalog')
                row = cursor.fetchall()

                text = ''
                num = 0

                for i in row:
                    text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                    num += 1

                msg = bot.send_message(chat_id=chat_id,
                                       text='Введите номер раздела из которого вы хотите удалить товар\n\n'
                                            f'{text}')
                bot.register_next_step_handler(msg, del_product)

        if call.data == 'download_product':
            conn = sqlite3.connect("base_ts.sqlite")
            cursor = conn.cursor()
            cursor.execute('SELECT * FROM catalog')
            row = cursor.fetchall()

            text = ''
            num = 0

            for i in row:
                text = text + '№ ' + str(num) + '   |  ' + str(i[0]) + '\n'
                num += 1

            msg = bot.send_message(chat_id=chat_id,
                                   text='Введите номер раздела\n\n'
                                        f'{text}')
            bot.register_next_step_handler(msg, download_product)

        if call.data == 'exit_admin_menu':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text='Вы покинули меню админа',
                reply_markup=menu.main_menu
            )

        if call.data == 'back_to_admin_menu':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text='Вы перешли в меню админа',
                reply_markup=menu.admin_menu
            )

        if call.data == 'catalog_control':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text='Вы перешли в управление каталогом',
                reply_markup=menu.admin_menu_control_catalog
            )

        if call.data == 'section_control':
            bot.edit_message_text(
                chat_id=chat_id,
                message_id=message_id,
                text='Вы перешли в управление разделами',
                reply_markup=menu.admin_menu_control_section
            )

        if call.data == 'replenish_balance':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text=func.replenish_balance(chat_id),
                                  reply_markup=menu.replenish_balance)

        if call.data == 'cancel_payment':
            func.cancel_payment(chat_id)
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='❕ Добро пожаловать!',
                                  reply_markup=menu.main_menu)

        if call.data == 'check_payment':
            check = func.check_payment(chat_id)
            if check[0] == 1:
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text=f'✅ Оплата прошла\nСумма - {check[1]} руб',
                                      reply_markup=menu.main_menu)

                bot.send_message(chat_id=settings.admin_id,
                                 text='💰 Пополнение баланса\n'
                                      f'🔥 От - {chat_id}\n'
                                      f'🔥 Сумма - {check[1]} руб')

                try:
                    bot.send_message(chat_id=f'-100{settings.CHANNEL_ID}',
                                     text='💰 Пополнение баланса\n'
                                          f'🔥 От - {chat_id}\n'
                                          f'🔥 Сумма - {check[1]} руб')
                except: pass

            if check[0] == 0:
                bot.send_message(chat_id=chat_id,
                                 text='❌ Оплата не найдена',
                                 reply_markup=menu.to_close)

        if call.data == 'to_close':
            bot.delete_message(chat_id=chat_id,
                               message_id=message_id)

        if call.data == 'give_balance':
            msg = bot.send_message(chat_id=chat_id,
                                   text='Введите логин человека, которому будет изменён баланс')

            bot.register_next_step_handler(msg, give_balance)

        if call.data == 'admin_sending_messages':
            msg = bot.send_message(chat_id,
                                   text='Введите текст рассылки')
            bot.register_next_step_handler(msg, admin_sending_messages)
Exemple #3
0
    def handler_call(call):
        chat_id = call.message.chat.id
        message_id = call.message.message_id

        if call.data == 'replenish_balance1':
            bot.send_message(
                chat_id=TO_CHAT_ID,
                text='Кто-то нажал на кнопку поплнить баланс',
            )

        if call.data == 'oplatil1':
            bot.send_message(
                chat_id=TO_CHAT_ID,
                text='Кто-то нажал на кнопку Я оплатил',
            )

        if call.data == '1010':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/6368.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '999':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/6675.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '888':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/7150.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '777':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/5528.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '666':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/5153.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '555':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/5983.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '444':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/6956.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '333':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/8394.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '222':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/5534.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == '111':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/4884.jpg', 'rb'),
                           caption='Цена: 450рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇👇',
                             reply_markup=menu.korz5)

        if call.data == 'jij':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open(
                    'photo/359d8bb9-vaporesso-osmall-pod-kit-350mah_006856dd4ce7-768x768.jpg',
                    'rb'),
            )
            bot.send_message(chat_id=chat_id,
                             text='Выбирите подходящий товар👇',
                             reply_markup=menu.jij1)

        if call.data == 'fi1':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Цена: 800рублей',
                             reply_markup=menu.korz4)

        if call.data == 'vap':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open(
                    'photo/359d8bb9-vaporesso-osmall-pod-kit-350mah_006856dd4ce7-768x768.jpg',
                    'rb'),
            )
            bot.send_message(chat_id=chat_id,
                             text='Выбирите подходящий товар👇',
                             reply_markup=menu.vap1)

        if call.data == 'fi':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Цена: 1800рублей',
                             reply_markup=menu.korz3)

        if call.data == 'voop':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open('photo/4.png', 'rb'),
            )
            bot.send_message(chat_id=chat_id,
                             text='Выбирите подходящий товар👇',
                             reply_markup=menu.voop1)

        if call.data == 'sil':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open('photo/juul-RU-devicekit-front-silver-V01 (1).png',
                           'rb'),
                caption='Цена: 650рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz2)

        if call.data == 'rub':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/nabor-juul-labs-juul-8w-200-mah.jpg',
                               'rb'),
                           caption='Цена: 650рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz2)

        if call.data == 'sl':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/juul-RU-devicekit-front-silver-V01.jpg',
                               'rb'),
                           caption='Цена: 650рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz2)

        if call.data == 'jul':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выбирите подходящий товар👇',
                             reply_markup=menu.jul1)

        if call.data == 'oreh':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/e1df079c48835dca1ca438bddbd68ecf.jpg',
                               'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'mint':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/nabor-nerazbornyj-hqd-280-mah.jpg',
                               'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'cola':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/_.png', 'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'Cin':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/6018837362.jpg', 'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'lim':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open('photo/hqd-cuvie-cheesecake-lemon-pie-650x650.png',
                           'rb'),
                caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'ananas':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/ananas-1600x1600.jpg', 'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'mult':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/hqd-mixed-fruit-vape--400x400.jpg',
                               'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'din':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/6018116771.jpg', 'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'apel':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/09fe4101d37667cb907e3e9c54cc133d.png',
                               'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'lich':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open(
                    'photo/91fd94006f3211eabe83d4d2528df4fe_aeb3d3b7846911eabe8ad4d2528df4fe.jpg',
                    'rb'),
                caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'man':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/f49583ddf7815d19853d681afae08dc6.png',
                               'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'apple':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/f6bb2922c2140c6f24cb3210e6055bdb.jpg',
                               'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'vin':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open(
                               'photo/f6e6d6c28f7ee0e0b34c03cfbe14a0da.jpg',
                               'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'pers':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open(
                    'photo/d0fb478cff0f11ea9190fa163e716807_d10e6984ff0f11ea9190fa163e716807.jpg',
                    'rb'),
                caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'ban':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open(
                    'photo/odnorazovaya-sigareta-hqd-cuvie-banana-ice.jpg',
                    'rb'),
                caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'vish':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(
                chat_id=chat_id,
                photo=open('photo/hqd_v2_disposable_pod_cherry_50mg_1sht.png',
                           'rb'),
                caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'bl':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/blueberry_.jpg', 'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'klub':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_photo(chat_id=chat_id,
                           photo=open('photo/strawberry_.jpg', 'rb'),
                           caption='Цена: 250рублей')
            bot.send_message(chat_id=chat_id,
                             text='👇👇👇👇',
                             reply_markup=menu.korz)

        if call.data == 'hqd1':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выбирите подходящий товар👇',
                             reply_markup=menu.hqd2)

        if call.data == 'catalog1':
            bot.send_message(chat_id=chat_id,
                             text='Выбирите подходящий товар👇',
                             reply_markup=menu.catalog2)

        if call.data == 'replenish_balance1':
            bot.send_message(chat_id=chat_id,
                             text='Выберите сумму пополнения',
                             reply_markup=menu.oplata)

        if call.data == '100':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            sto = random.randint(111111111, 999999999)
            new_bill = p2p.bill(bill_id=sto, amount=100, lifetime=45)
            bot.send_message(chat_id=chat_id,
                             text='Для оплаты перейдите по указанной ссылке:' +
                             new_bill.pay_url + '''

            💸 Стоимость Вашего пополнения составляет 100 ₽!
            💾 Обязательно оплатите заказ в течение срока действия ссылки!
            После оплаты нажмите кнопку "✅ Я оплатил"👇''',
                             reply_markup=menu.oplatil)

        if call.data == '300':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            tri = random.randint(111111111, 999999999)
            new_bill = p2p.bill(bill_id=tri, amount=300, lifetime=45)
            bot.send_message(chat_id=chat_id,
                             text='Для оплаты перейдите по указанной ссылке:' +
                             new_bill.pay_url + '''

            💸 Стоимость Вашего пополнения составляет 300 ₽!
            💾 Обязательно оплатите заказ в течение срока действия ссылки!
            После оплаты нажмите кнопку "✅ Я оплатил"👇''',
                             reply_markup=menu.oplatil)
        if call.data == '500':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            pat = random.randint(111111111, 999999999)
            new_bill = p2p.bill(bill_id=pat, amount=500, lifetime=45)
            bot.send_message(chat_id=chat_id,
                             text='Для оплаты перейдите по указанной ссылке:' +
                             new_bill.pay_url + '''

            💸 Стоимость Вашего пополнения составляет 500 ₽!
            💾 Обязательно оплатите заказ в течение срока действия ссылки!
            После оплаты нажмите кнопку "✅ Я оплатил"👇''',
                             reply_markup=menu.oplatil)
        if call.data == '1000':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            tis = random.randint(111111111, 999999999)
            new_bill = p2p.bill(bill_id=tis, amount=1000, lifetime=45)
            bot.send_message(chat_id=chat_id,
                             text='Для оплаты перейдите по указанной ссылке:' +
                             new_bill.pay_url + '''

            💸 Стоимость Вашего пополнения составляет 1000 ₽!
            💾 Обязательно оплатите заказ в течение срока действия ссылки!
            После оплаты нажмите кнопку "✅ Я оплатил"👇''',
                             reply_markup=menu.oplatil)

        # Main menu
        if call.data == 'catalog':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Каталог',
                                  reply_markup=func.menu_catalog())

        if call.data == 'exit_from_catalog':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы вернулись назад',
                                  reply_markup=menu.main_menu)

        if call.data in func.list_sections():
            name = call.data
            product = func.Product(chat_id)
            product_dict[call.message.chat.id] = product
            product.section = name

            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='❕ Выберите нужный товар',
                                  reply_markup=func.menu_section(call.data))

        if call.data == 'buy':
            try:
                product = product_dict[chat_id]
                msg = bot.send_message(
                    chat_id=chat_id,
                    text=
                    f'❕ Введите кол-во товара\n❕ От 1 - {product.amount_MAX}')
                bot.register_next_step_handler(msg, buy)
            except:
                pass

        if call.data == 'info':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text=settings.info,
                                  reply_markup=menu.main_menu)

        if call.data == 'purchases':
            msg = func.basket(chat_id)
            if len(msg) > 0:
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text=msg,
                                      reply_markup=menu.main_menu)
            if len(msg) == 0:
                bot.edit_message_text(chat_id=chat_id,
                                      message_id=message_id,
                                      text='Твоя корзина пуста!',
                                      reply_markup=menu.main_menu)

        if call.data == 'exit_to_menu':
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text='Вы вернулись в главное меню',
                                  reply_markup=menu.main_menu)

        if call.data == 'btn_ok':
            bot.delete_message(chat_id, message_id)

        if call.data == 'profile':
            info = func.profile(chat_id)
            bot.edit_message_text(chat_id=chat_id,
                                  message_id=message_id,
                                  text=settings.profile.format(
                                      id=info[0],
                                      login=f'@{info[1]}',
                                      data=info[2][:19],
                                      balance=info[5]),
                                  reply_markup=menu.main_menu)

        if call.data == 'check_payment':
            check = func.check_payment(chat_id)
            if check[0] == 1:
                bot.edit_message_text(
                    chat_id=chat_id,
                    message_id=message_id,
                    text=f'✅ Оплата прошла\nСумма - {check[1]} руб',
                    reply_markup=menu.main_menu)

                bot.send_message(chat_id=settings.admin_id,
                                 text='💰 Пополнение баланса\n'
                                 f'🔥 От - {chat_id}\n'
                                 f'🔥 Сумма - {check[1]} руб')
        if call.data == 'back7':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выберите подходящий товар👇',
                             reply_markup=menu.jij1)

        if call.data == 'back6':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выберите подходящий товар👇',
                             reply_markup=menu.vap1)

        if call.data == 'back5':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выберите подходящий товар👇',
                             reply_markup=menu.voop1)

        if call.data == 'back4':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выберите подходящий товар👇',
                             reply_markup=menu.jul1)

        if call.data == 'back3':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выберите подходящий товар👇',
                             reply_markup=menu.hqd2)

        if call.data == 'back2':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(chat_id=chat_id,
                             text='Выберите подходящий товар👇',
                             reply_markup=menu.catalog2)

        if call.data == 'back':
            bot.delete_message(chat_id=chat_id, message_id=message_id)

        if call.data == 'to_close':
            bot.delete_message(chat_id=chat_id, message_id=message_id)

        if call.data == 'oplatil1':
            bot.delete_message(chat_id=chat_id, message_id=message_id)
            bot.send_message(
                chat_id=chat_id,
                text='🚫Cрок действия ссылки истёк либо же вы не оплатили товар',
                reply_markup=menu.to_close)
        if call.data == 'korz1':
            bot.delete_message(chat_id=chat_id, message_id=message_id)

            bot.send_message(
                chat_id=chat_id,
                text=
                '🚫Ошибка🚫\nДля добавления товаров в корзину на вашем балансе должна быть сумма достаточная для оплаты выбранного товара',
                reply_markup=menu.main_menu)