Beispiel #1
0
def redact_order(call):
    if call.data[0] == '+':
        storage.add_to_order(chat_id=call.message.chat.id, data=call.data[1:])
        print(storage.get_user_string(chat_id=call.message.chat.id))
        bot.answer_callback_query(callback_query_id=call.id,
                                  show_alert=False,
                                  text='+' + str(call.data[-3:]) +
                                  constants.to_bill)
    if call.data[0] == '-':
        storage.remove_from_order(chat_id=call.message.chat.id,
                                  data=call.data[1:])
        print(storage.get_user_string(chat_id=call.message.chat.id))
        bot.answer_callback_query(callback_query_id=call.id,
                                  show_alert=False,
                                  text='-' + str(call.data[-3:]) +
                                  constants.from_bill)

    mes_text = utils.send_order_list(call.message.chat.id)
    keyboard = telebot.types.InlineKeyboardMarkup()
    for i in constants.coffee_list:
        keyboard.add(
            telebot.types.InlineKeyboardButton(text=i['text'],
                                               callback_data=i['call']))
        keyboard.add(
            telebot.types.InlineKeyboardButton(text=constants.plus,
                                               callback_data='+' + i['call']),
            telebot.types.InlineKeyboardButton(text=constants.minus,
                                               callback_data='-' + i['call']))
    keyboard.add(
        telebot.types.InlineKeyboardButton(text=constants.back,
                                           callback_data="back_to_order"))
    bot.edit_message_text(chat_id=call.message.chat.id,
                          text=mes_text,
                          message_id=call.message.message_id,
                          reply_markup=keyboard)
Beispiel #2
0
def order_coffee(call):
	keyboard = telebot.types.InlineKeyboardMarkup()
	for i in constants.coffee_list:
		keyboard.add(telebot.types.InlineKeyboardButton(text=i['text'], callback_data=i['call']))
		keyboard.add(telebot.types.InlineKeyboardButton(text=constants.plus, callback_data='+'+i['call']), telebot.types.InlineKeyboardButton(text=constants.minus, callback_data='-'+i['call']) )
	keyboard.add(telebot.types.InlineKeyboardButton(text=constants.back, callback_data="back_to_order"))
	mes_text = utils.send_order_list(call.message.chat.id)
	bot.edit_message_text(chat_id = call.message.chat.id, text = mes_text, message_id=call.message.message_id, reply_markup = keyboard)
Beispiel #3
0
def make_order(call):
	arr = storage.get_user_string(call.message.chat.id)['order']
	keyboard = telebot.types.InlineKeyboardMarkup()
	keyboard.add(telebot.types.InlineKeyboardButton(text=constants.coffee, callback_data='order_coffee'))
	keyboard.add(telebot.types.InlineKeyboardButton(text=constants.dessert, callback_data='order_dessert'))
	keyboard.add(telebot.types.InlineKeyboardButton(text=constants.sandwitch, callback_data='order_sandwitch'))
	if arr:
		keyboard.add(telebot.types.InlineKeyboardButton(text=constants.checkout, callback_data='checkout'))
	keyboard.add(telebot.types.InlineKeyboardButton(text=constants.back_to_menu, callback_data="back_to_menu"))
	mes_text = utils.send_order_list(call.message.chat.id)
	bot.edit_message_text(chat_id = call.message.chat.id, text = mes_text, message_id=call.message.message_id, reply_markup = keyboard)
Beispiel #4
0
def clear_storage(message):
	storage.clear_all()
	print(utils.send_order_list(message.chat.id))
Beispiel #5
0
def clear_storage(message):
    storage.clear_all()
    log.making_logs(utils.send_order_list(message.chat.id))