예제 #1
0
파일: bot.py 프로젝트: IwanDewald/Iwan
def edit_app_form(message):
    editing_item = storage.get_editing_item(message.chat.id)
    log.making_logs(editing_item)
    if editing_item:
        storage.edit_user_string(chat_id=message.chat.id, data=message.text)
        keyboard = telebot.types.InlineKeyboardMarkup()
        app_form = utils.send_app_form(storage.get_user_string(
            message.chat.id))
        items = constants.app_form_ru
        keyboard.add(
            telebot.types.InlineKeyboardButton(text=items['name'],
                                               callback_data='name'),
            telebot.types.InlineKeyboardButton(text=items['country'],
                                               callback_data='country'))
        keyboard.add(
            telebot.types.InlineKeyboardButton(text=items['city'],
                                               callback_data='city'),
            telebot.types.InlineKeyboardButton(text=items['occupation'],
                                               callback_data='occupation'))
        keyboard.add(
            telebot.types.InlineKeyboardButton(text=items['birthdate'],
                                               callback_data='birthdate'),
            telebot.types.InlineKeyboardButton(text=items['favorite'],
                                               callback_data='favorite'))
        keyboard.add(
            telebot.types.InlineKeyboardButton(text=constants.back,
                                               callback_data="back_to_menu"))
        bot.send_message(message.chat.id, text=app_form, reply_markup=keyboard)
    log.making_logs(message.text.encode())
예제 #2
0
파일: bot.py 프로젝트: IwanDewald/Iwan
def list_of_items(call):
    storage.drop_editing_item(call.message.chat.id)
    keyboard = telebot.types.InlineKeyboardMarkup()
    app_form = utils.send_app_form(
        storage.get_user_string(call.message.chat.id))
    items = constants.app_form_ru
    keyboard.add(
        telebot.types.InlineKeyboardButton(text=items['name'],
                                           callback_data='name'),
        telebot.types.InlineKeyboardButton(text=items['country'],
                                           callback_data='country'))
    keyboard.add(
        telebot.types.InlineKeyboardButton(text=items['city'],
                                           callback_data='city'),
        telebot.types.InlineKeyboardButton(text=items['occupation'],
                                           callback_data='occupation'))
    keyboard.add(
        telebot.types.InlineKeyboardButton(text=items['birthdate'],
                                           callback_data='birthdate'),
        telebot.types.InlineKeyboardButton(text=items['favorite'],
                                           callback_data='favorite'))
    keyboard.add(
        telebot.types.InlineKeyboardButton(text=constants.back,
                                           callback_data="back_to_menu"))

    bot.edit_message_text(chat_id=call.message.chat.id,
                          message_id=call.message.message_id,
                          text=app_form,
                          reply_markup=keyboard)