def next_option(tg_chat, poll, options): """Send the options message during the creation .""" locale = poll.user.locale poll.user.expected_input = ExpectedInput.options.name keyboard = get_options_entered_keyboard(poll) if len(options) == 1: text = i18n.t("creation.option.single_added", locale=locale, option=options[0]) else: text = i18n.t("creation.option.multiple_added", locale=locale) for option in options: text += f"\n*{option}*" text += "\n\n" + i18n.t("creation.option.next", locale=locale) tg_chat.send_message(text, reply_markup=keyboard, parse_mode="Markdown")
def close_creation_datepicker(session, context, poll): """Close the datepicker during the creation of a poll.""" user = context.user if len(poll.options) == 0: text = i18n.t("creation.option.first", locale=user.locale) keyboard = get_open_datepicker_keyboard(poll) else: text = i18n.t("creation.option.next", locale=user.locale) keyboard = get_options_entered_keyboard(poll) message = context.query.message # Replace the message completely, since all options have already been entered if user.expected_input != ExpectedInput.date.name: message.edit_text(i18n.t("creation.option.finished", locale=user.locale)) return user.expected_input = ExpectedInput.options.name message.edit_text(text, parse_mode="markdown", reply_markup=keyboard)