Ejemplo n.º 1
0
def reset_command_handler(message):
    db_remove_places(message)
    db_update_chat(
            chat_id=message.chat.id,
            step=add_step.OFF
        )
    if not db_get_places(message.chat.id, 0).all():
        bot.send_message(
            chat_id=message.chat.id,
            text='Успішно видалено',
            reply_markup=create_main_keyboard()
        )
Ejemplo n.º 2
0
def add_place_name_handler(message):
    place = db_update_places(message=message, bot=bot)

    db_update_chat(
        chat_id=message.chat.id,
        step=add_step.LOCATION,
        place_id=place.id
    )

    bot.send_message(
        chat_id=message.chat.id,
        text='Додайте геолокацію',
        reply_markup=create_skip_stop_keyboard()
    )
Ejemplo n.º 3
0
def add_photo_handler(message):
    db_update_places(
        message=message,
        bot=bot,
        place_id=db_get_chat(message.chat.id).place.id
    )
    db_update_chat(
        chat_id=message.chat.id,
        step=add_step.COMMENT
    )

    bot.send_message(
        chat_id=message.chat.id,
        text='Напишіть коментар',
        reply_markup=create_skip_stop_keyboard(skip=False)
    )
Ejemplo n.º 4
0
def add_location_handler(message):
    db_update_places(
        message=message,
        bot=bot,
        place_id=db_get_chat(message.chat.id).place.id
    )
    db_update_chat(
        chat_id=message.chat.id,
        step=add_step.PHOTO,
    )

    bot.send_message(
        chat_id=message.chat.id,
        text='Додайте фото',
        reply_markup=create_skip_stop_keyboard()
    )
Ejemplo n.º 5
0
def add_comment_handler(message):
    db_update_places(
        message=message,
        bot=bot,
        place_id=db_get_chat(message.chat.id).place.id
    )
    db_chat = db_update_chat(
        chat_id=message.chat.id,
        step=add_step.OFF
    )

    send_success_message(
        message=message,
        place_id=db_chat.place.id
    )
Ejemplo n.º 6
0
def add_skip_query_handler(callback_query):
    message = callback_query.message
    data = callback_query.data

    if data == 'skip':
        step = get_step(message.chat.id)
        if step == add_step.LOCATION:
            add_location_handler(message)
        elif step == add_step.PHOTO:
            add_photo_handler(message)
        else:
            data = 'stop'

    if data == 'stop':
        db_chat = db_update_chat(
            chat_id=message.chat.id,
            step=add_step.OFF
        )
        send_success_message(
            message=message,
            place_id=db_chat.place.id
        )
Ejemplo n.º 7
0
def add_command_handler(message):
    db_update_chat(chat_id=message.chat.id, step=add_step.NAME)
    bot.send_message(
        chat_id=message.chat.id,
        text='Напишіть назву'
    )