def get_due_date_datepicker_keyboard(poll): """Get the done keyboard for options during poll creation.""" locale = poll.user.locale datepicker_buttons = get_datepicker_buttons(poll) pick_payload = f'{CallbackType.settings_pick_due_date.value}:{poll.id}:0' # Add remove due date button if poll.due_date is not None: remove_payload = f'{CallbackType.settings_remove_due_date.value}:{poll.id}:0' row = [ InlineKeyboardButton( i18n.t('datepicker.remove_due_date', locale=locale), callback_data=remove_payload), ] datepicker_buttons.append(row) # Add back and pick buttons row = [ get_back_to_settings_button(poll), InlineKeyboardButton( i18n.t('datepicker.due_date', locale=locale), callback_data=pick_payload), ] datepicker_buttons.append(row) return InlineKeyboardMarkup(datepicker_buttons)
def get_creation_datepicker_keyboard(poll): """Get the done keyboard for options during poll creation.""" locale = poll.user.locale datepicker_buttons = get_datepicker_buttons(poll) # Create back and done buttons close_payload = f'{CallbackType.close_creation_datepicker.value}:{poll.id}:0' buttons = [ InlineKeyboardButton(i18n.t('keyboard.close', locale=locale), callback_data=close_payload) ] if len(poll.options) > 0: done_payload = f'{CallbackType.all_options_entered.value}:{poll.id}:0' buttons.append( InlineKeyboardButton(i18n.t('keyboard.done', locale=locale), callback_data=done_payload)) datepicker_buttons.append(buttons) # Create pick button pick_payload = f'{CallbackType.pick_date_option.value}:{poll.id}:0' datepicker_buttons.append([ InlineKeyboardButton(i18n.t('datepicker.pick_date', locale=locale), callback_data=pick_payload) ]) return InlineKeyboardMarkup(datepicker_buttons)
def get_add_option_datepicker_keyboard(poll): """Get the done keyboard for options during poll creation.""" locale = poll.user.locale datepicker_buttons = get_datepicker_buttons(poll) # Add back and pick buttons pick_payload = f'{CallbackType.pick_date_option.value}:{poll.id}:0' row = [ get_back_to_settings_button(poll), InlineKeyboardButton(i18n.t('datepicker.pick_date', locale=locale), callback_data=pick_payload), ] datepicker_buttons.append(row) return InlineKeyboardMarkup(datepicker_buttons)
def get_external_datepicker_keyboard(poll): """Get the done keyboard for options during poll creation.""" datepicker_buttons = get_datepicker_buttons(poll) # Add back and pick buttons pick_payload = f'{CallbackType.pick_date_option.value}:{poll.id}:0' back_payload = f'{CallbackType.external_open_menu.value}:{poll.id}:0' cancel_payload = f'{CallbackType.external_cancel.value}:{poll.id}:0' rows = [ [ InlineKeyboardButton(i18n.t('keyboard.back', locale=poll.locale), callback_data=back_payload), InlineKeyboardButton(i18n.t('keyboard.cancel', locale=poll.locale), callback_data=cancel_payload) ], [ InlineKeyboardButton(i18n.t('datepicker.pick_date', locale=poll.locale), callback_data=pick_payload) ], ] datepicker_buttons += rows return InlineKeyboardMarkup(datepicker_buttons)