Ejemplo n.º 1
0
def add(id):
    markup = base.item_finder(id).get_desc2()
    print('id : ' + str(id))
    #butp = telebot.types.InlineKeyboardButton('+', callback_data='+'+str(id))
    #butm = telebot.types.InlineKeyboardButton('-', callback_data='-'+str(id))
    #markup.row(butp, butm)
    #print('callback.data : \n' + str(butp.callback_data[0]) + '\n' + str(int(butp.callback_data[1:])))
    return markup
Ejemplo n.º 2
0
Archivo: bot.py Proyecto: XrayT3/Kazbot
def transaction(message):
    print(uploaded_items)
    items = uploaded_items
    while items:
        print('processing names...')
        item = items.popitem()
        if item[1] > 0:
            it = base.item_finder(item[0])
            message1 = 'Заказ: ' + str(it.description) + ' Покупатель' + ' : ' + '@' + str(it.seller)
            bot.send_message(message.chat.id, message1)
Ejemplo n.º 3
0
Archivo: bot.py Proyecto: XrayT3/Kazbot
def callback_handler(call):
    print('uploaded_items : ' + str(uploaded_items))
    print('callback_handler.call.data = ' + str(call.data))
    #markup = markups.add(call.data)
    #numb = telebot.types.InlineKeyboardButton(str(uploaded_items.get(call.data)), callback_data='.')
    #markup.add(numb)
    #bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=markup)
    items = uploaded_items
    it = base.item_finder(call.data)
    message1 = 'Заказ: ' + str(it.description) + ' Покупатель' + ' : ' + '@' + str(it.seller)
    bot.send_message(call.message.chat.id, message1)
Ejemplo n.º 4
0
Archivo: bot.py Proyecto: XrayT3/Kazbot
def transaction(call):
    message = "К ожалению, онлайн-системы оплаты пока что находятся в разработке.\n" \
              "Вместо этого, вы можете обсудить средства перевода денег с продавцом товаров\n"
    print(uploaded_items)
    items = uploaded_items
    while items:
        print('processing names...')
        item = items.popitem()
        if item[1] > 0:
            it = base.item_finder(item[0])
            message += str(it.company) + str(it.name) + ' : ' + '@' + str(it.seller)
            bot.send_invoice(call.message.chat.id, it.name, it.description)
            bot.send_invoice()
    bot.edit_message_text(message, call.message.chat.id, call.message.message_id)
Ejemplo n.º 5
0
Archivo: bot.py Proyecto: XrayT3/Kazbot
def handle_minus(call):
    try:
        if uploaded_items[str(int(call.data[1:]))]:
            uploaded_items[str(int(call.data[1:]))] -= 1
    except KeyError as e:
        config.log(Error=e, text='WRONG_KEY')
    if uploaded_items[str(int(call.data[1:]))] == 0:
        key = (base.item_finder(call.data[1:])).get_desc2()

        key.row_width = 1
        bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=key)
        return
    markup = markups.add(call.data[1:])
    numb = telebot.types.InlineKeyboardButton(str(uploaded_items.get(str(int(call.data[1:])))), callback_data='.')
    markup.row(numb)
    bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=markup)
    print('uploaded items = ' + str(uploaded_items))
    return