Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar not forwarding more than 1 month #7

Open
cokelopez opened this issue Aug 25, 2021 · 0 comments
Open

Calendar not forwarding more than 1 month #7

cokelopez opened this issue Aug 25, 2021 · 0 comments

Comments

@cokelopez
Copy link

I tried to use the code for a calendar in my python bot the following way:

def get_telefono(update: Update, context: CallbackContext) -> None:
    telefono = update.message.text
    context.user_data['telefono'] = telefono
    user_data = context.user_data
    respuesta = 'Fecha de Vencimiento AAAA-MM-DD'
    calendar = telegramcalendar.create_calendar()
    update.message.reply_text(respuesta, reply_markup=calendar)
    return GET_VENCIMIENTO

def get_vencimiento(update: Update, context: CallbackContext) -> None:
    bot = context.bot
    selected, date = telegramcalendar.process_calendar_selection(bot, update)
   
    if selected:
        respuesta = date.strftime("%d/%m/%Y")
        update.message.reply_text(respuesta, reply_markup=ReplyKeyboardRemove())
    return GET_PAGO

updater = Updater(settings.TOKEN)
        dispatcher = updater.dispatcher

        conv_handler = ConversationHandler(
            entry_points=[CommandHandler('start', start, Filters.user(username="@cokelopez"))],
            states={

            
                GET_TELEFONO: [MessageHandler(Filters.regex('^\+?1?\d{9,15}$'), get_telefono)],
                GET_VENCIMIENTO: [CallbackQueryHandler(get_vencimiento)],
            
                
            },
            fallbacks=[CommandHandler('cancel', cancel)],
            allow_reentry = True,

        )
        dispatcher.add_handler(conv_handler)
        dispatcher.add_error_handler(error)

        mode = os.environ.get("MODE", "polling")
      
        updater.start_polling()

        updater.idle()

The calendar is displayed and it start in August 2021 I click to forward to September and it workd, but when I try to forward to October or go back to August it does not work.

I'm using Django as a framework, I just pasted part of the code of my bot, I'm using the Context because I collect the answers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant