Esempio n. 1
0
def show_types(user_id):
    markup = telebot.types.InlineKeyboardMarkup()
    for key in base.give_menu():
        button = telebot.types.InlineKeyboardButton(text=key,
                                                    callback_data=key)
        markup.add(button)
    print(base.give_menu())
    return markup
Esempio n. 2
0
def show_types():
    markup = telebot.types.InlineKeyboardMarkup()
    for key in base.give_menu():
        button = telebot.types.InlineKeyboardButton(text=key, callback_data=key)
        markup.add(button)
    #btn_registraciy = telebot.types.InlineKeyboardButton(text="Регистрация покупателей отходов",
         #                                                callback_data='registraciy_panel')
    #markup.add(btn_registraciy)
    return markup
Esempio n. 3
0
def delete_kat():
    markup = telebot.types.InlineKeyboardMarkup()
    for key in base.give_menu():
        button = telebot.types.InlineKeyboardButton(text=key,
                                                    callback_data="?" + key)
        markup.add(button)
    btn_menu = telebot.types.InlineKeyboardButton(
        text="Вернуться в админ-панель", callback_data="celler_panel")
    markup.add(btn_menu)
    return markup
Esempio n. 4
0
def show_types(user_id):
    markup = telebot.types.InlineKeyboardMarkup()
    for key in base.give_menu():
        button = telebot.types.InlineKeyboardButton(text=key,
                                                    callback_data=key)
        markup.add(button)
    if base.is_seller(user_id):
        btn_menu = telebot.types.InlineKeyboardButton(
            text="Админ-панель", callback_data='celler_panel')
        markup.add(btn_menu)
    return markup
Esempio n. 5
0
        a = random.randint(50, 100)
        keyboard = telebot.types.ReplyKeyboardMarkup(resize_keyboard=True)
        keyboard.row('Органика', 'Синтетика')
        keyboard.row('Прочее', 'Назад')
        bot.send_message(
            message.chat.id,
            'В городе {name} найдено '.format(name=message.text) + str(a) +
            ' результатов.')
        print(message.text)
        bot.send_message(message.chat.id,
                         'Выберите нужную категорию.',
                         reply_markup=markups.show_types(message.chat.id))


# Отображение товаров и занесение их в кэш
@bot.callback_query_handler(func=lambda call: call.data in base.give_menu())
def show_items(call):
    for item in base.type_finder(call.data):
        key = item.get_desc2()
        uploaded_items[str(item.id)] = 0
        print(uploaded_items)
        try:
            url = item.url
            photo = open("temp.jpg", 'w')  # Инициализация файла
            photo.close()
            photo = open("temp.jpg", 'rb')
            urllib.urlretrieve(url, "temp.jpg")
            bot.send_photo(chat_id=call.message.chat.id, photo=photo)
            bot.send_message(call.message.chat.id,
                             item.description,
                             reply_markup=key)
Esempio n. 6
0
def add_item():
    markup = telebot.types.ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True)
    for category in base.give_menu():
        markup.add(category)
    return markup