Exemple #1
0
def predefined_add_date(bot: Bot, update: Update, user_data: dict) -> str:
    """The function suggests choosing tomorrow's date and after tomorrow.

    :param bot: Bot
    :param update: Update
    :param user_data: User data
    :return: The function sends a message to the user with a request 
             to enter a hours. 
    """
    user_data['date'] = update.message.text
    text_message = settings.ENTER_HOURS
    update.message.reply_text(
        text_message,
        reply_markup=reminder_add_digital_period_keyboard(
            hour_remaining(user_data['date']), 23, 10, 1))

    return "manual_add_date_hour"
Exemple #2
0
def manual_add_date_hour(bot: Bot, update: Update, user_data: dict) -> str:
    """The function adds hour to the dictionary 
       user_data and sends a message to the user with a request to enter minute.

    :param bot: Bot
    :param update: Update
    :param user_data: User data
    :return: The function sends a message to the user with a request 
             to enter a minute. 
    """
    user_data['hours'] = update.message.text
    start_minute = minute_remaining(user_data, 5)
    text_message = settings.ENTER_MINUTES
    update.message.reply_text(
        text_message,
        reply_markup=reminder_add_digital_period_keyboard(
            start_minute, 59, 10, 5))

    return "manual_add_date_minute"
Exemple #3
0
def manual_add_date_month(bot: Bot, update: Update, user_data: dict) -> str:
    """The function adds month to the dictionary 
       user_data and sends a message to the user with a request to enter year.

    :param bot: Bot
    :param update: Update
    :param user_data: User data
    :return: The function sends a message to the user with a request 
             to enter a month. 
    """
    user_data['month'] = update.message.text
    period_days = day_remaining(user_data)
    text_message = settings.ENTER_DAY
    update.message.reply_text(
        text_message,
        reply_markup=reminder_add_digital_period_keyboard(
            period_days.get('start'), period_days.get('end'), 10, 1))

    return "manual_add_date_day"
Exemple #4
0
def manual_add_date_year(bot: Bot, update: Update, user_data: dict) -> str:
    """The function adds year to the dictionary 
       user_data and sends a message to the user with a request to enter hour.

    :param bot: Bot
    :param update: Update
    :param user_data: User data
    :return: The function sends a message to the user with a request 
             to enter a hour. 
    """
    user_data['year'] = update.message.text
    start_month = month_remaining(user_data['year'])
    text_message = settings.ENTER_MONTH
    update.message.reply_text(
        text_message,
        reply_markup=reminder_add_digital_period_keyboard(
            start_month, 12, 10, 1))

    return "manual_add_date_month"
Exemple #5
0
def manual_add_date(bot: Bot, update: Update, user_data: dict) -> str:
    """The initial date entry function and sends a message to the user with 
       request to enter a day.

    :param bot: Bot
    :param update: Update
    :param user_data: User data
    :return: The function sends a message to the user with a request 
             to enter a day. 
    """
    text_message = settings.ENTER_YEAR
    start_year = datetime.now().year
    end_year = (datetime.now() + timedelta(days=1095)).year
    update.message.reply_text(
        text_message,
        reply_markup=reminder_add_digital_period_keyboard(
            start_year, end_year, 1, 1))

    return "manual_add_date_year"
Exemple #6
0
def manual_add_date_day(bot: Bot, update: Update, user_data: dict) -> str:
    """The function adds day to the dictionary 
       user_data and sends a message to the user with a request to enter month.

    :param bot: Bot
    :param update: Update
    :param user_data: User data
    :return: The function sends a message to the user with a request 
             to enter a month. 
    """
    text_message = settings.ENTER_HOURS
    user_data['day'] = update.message.text
    start_hour = hour_remaining('{}-{}-{}'.format(user_data['day'],
                                                  user_data['month'],
                                                  user_data['year']))
    update.message.reply_text(
        text_message,
        reply_markup=reminder_add_digital_period_keyboard(
            start_hour, 23, 10, 1))

    return "manual_add_date_hour"