Esempio n. 1
0
def ask_description(session, context, poll):
    """Asks user for description of the poll, in case the name was already supplied."""
    context.user.expected_input = ExpectedInput.description.name
    keyboard = get_skip_description_keyboard(poll)
    context.tg_chat.send_message(
        i18n.t("creation.description", locale=context.user.locale),
        reply_markup=keyboard,
    )
def handle_set_name(bot, update, session, user, text, poll, chat):
    """Set the name of the poll."""
    poll.name = text
    user.expected_input = ExpectedInput.description.name
    keyboard = get_skip_description_keyboard(poll)
    chat.send_message(
        i18n.t('creation.description', locale=user.locale),
        reply_markup=keyboard,
    )
def handle_set_name(bot, update, session, user, text, poll, chat):
    """Set the name of the poll."""
    poll.name = text

    if poll.name is None:
        return i18n.t("creation.error.invalid_poll_name", locale=user.locale)

    user.expected_input = ExpectedInput.description.name
    keyboard = get_skip_description_keyboard(poll)
    chat.send_message(
        i18n.t("creation.description", locale=user.locale),
        reply_markup=keyboard,
    )