예제 #1
0
def skip_description(session, context, poll):
    """Skip description creation step."""
    if len(poll.options) == 0:
        context.user.expected_input = ExpectedInput.options.name
        session.commit()
        context.query.message.edit_text(
            i18n.t("creation.option.first", locale=context.user.locale),
            reply_markup=get_open_datepicker_keyboard(poll),
        )
    else:  # options were already prefilled e.g. by native poll
        # TODO: what if user changed poll type?
        create_poll(session, poll, context.user, context.tg_chat, context.query.message)
예제 #2
0
def all_options_entered(session, context, poll):
    """All options are entered the poll is created."""
    if poll is None or poll.created:
        return

    locale = context.user.locale
    if poll.poll_type in [PollType.limited_vote.name, PollType.cumulative_vote.name]:
        message = context.query.message
        message.edit_text(i18n.t("creation.option.finished", locale=locale))
        context.user.expected_input = ExpectedInput.vote_count.name
        message.chat.send_message(i18n.t("creation.vote_count_request", locale=locale))

        return

    create_poll(
        session, poll, context.user, context.query.message.chat, context.query.message
    )