1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-22 05:54:18 +00:00

Horizontal product keyboard

This commit is contained in:
Steffo 2018-04-17 08:17:16 +02:00
parent 5ae466de13
commit a7fda3cfb3

View file

@ -331,8 +331,8 @@ class ChatWorker(threading.Thread):
# Create the product inline keyboard # Create the product inline keyboard
product_inline_keyboard = telegram.InlineKeyboardMarkup( product_inline_keyboard = telegram.InlineKeyboardMarkup(
[ [
[telegram.InlineKeyboardButton(strings.menu_add_to_cart, callback_data="cart_add")], [telegram.InlineKeyboardButton(strings.menu_add_to_cart, callback_data="cart_add"),
[telegram.InlineKeyboardButton(strings.menu_remove_from_cart, callback_data="cart_remove")] telegram.InlineKeyboardButton(strings.menu_remove_from_cart, callback_data="cart_remove")]
]) ])
# Create the final inline keyboard # Create the final inline keyboard
final_inline_keyboard = telegram.InlineKeyboardMarkup( final_inline_keyboard = telegram.InlineKeyboardMarkup(
@ -380,8 +380,8 @@ class ChatWorker(threading.Thread):
product_inline_list = [[telegram.InlineKeyboardButton(strings.menu_add_to_cart, product_inline_list = [[telegram.InlineKeyboardButton(strings.menu_add_to_cart,
callback_data="cart_add")]] callback_data="cart_add")]]
if cart[callback.message.message_id][1] > 0: if cart[callback.message.message_id][1] > 0:
product_inline_list.append([telegram.InlineKeyboardButton(strings.menu_remove_from_cart, product_inline_list[0].append(telegram.InlineKeyboardButton(strings.menu_remove_from_cart,
callback_data="cart_remove")]) callback_data="cart_remove"))
product_inline_keyboard = telegram.InlineKeyboardMarkup(product_inline_list) product_inline_keyboard = telegram.InlineKeyboardMarkup(product_inline_list)
# Create the final inline keyboard # Create the final inline keyboard
final_inline_list = [[telegram.InlineKeyboardButton(strings.menu_cancel, callback_data="cart_cancel")]] final_inline_list = [[telegram.InlineKeyboardButton(strings.menu_cancel, callback_data="cart_cancel")]]