Package: python-telegram-bot-calendar
python-telegram-bot-calendarVery simple inline calendar for your bot.Getting StartedThis library is tested on Python 3.6 and 3.7.Installationpipinstallpython-telegram-bot-calendarUsageThere is one main class - DetailedTelegramCalendar that can be used as follows. This is the example forpyTelegramBotAPIlibrary. Other libraries are also supported.fromtelegram_bot_calendarimportDetailedTelegramCalendar,LSTEP...@bot.message_handler(commands=['start'])defstart(m):calendar,step=DetailedTelegramCalendar().build()bot.send_message(m.chat.id,f"Select{LSTEP[step]}",reply_markup=calendar)@bot.callback_query_handler(func=DetailedTelegramCalendar.func())defcal(c):result,key,step=DetailedTelegramCalendar().process(c.data)ifnotresultandkey:bot.edit_message_text(f"Select{LSTEP[step]}",c.message.chat.id,c.message.message_id,reply_markup=key)elifresult:bot.edit_message_text(f"You selected{result}",c.message.chat.id,c.message.message_id)In start handler the calendar is created. Several arguments can be passed:calendar_id- small integer or string, used for calendar identification. It used when you need several different calendars (default - 0)current_date-datetime.dateobject, initial date value (default - today date)additional_buttons- 1D list of buttons that will be added to the bottom of the calendarlocale- eitheren,ru, oreo, can be added moremin_dateandmax_date- both are used as min and max values for the calendarAs you can see, special function that is provided should be passed to callback query handler. It will automatically work. The function takes only one argument -calendar_idthat is 0 by default.In the body of the handler function you need to call process function on callback data.WARNING!You need to create the calendar object again if it was not saved before.The functionprocessreturn tuple of size 3 -result,keyboard,step.result-datetime.dateobject if user finished selecting. OtherwiseNonekeyboard- inline keyboard markup if the result is not ready. OtherwiseNonestep-YEAR,MONTH,  orDAYif not ready.Noneis also possible if there is no change in keyboard.Advanced useSeveral calendarsYou can create as many calendars as you want. However, in order to handle them properly set differentcalendar_id'swhen  you want to distinguish them. Take a look at examples.Date rangesIn the class constructormin_dateandmax_date- both are used as min and max values for the calendar. If you add them, the calendar will not show undesired dates. Example:Custom styleYou can also write your own code. One of the examples is redefining the steps order.In the package you can findWMonthTelegramCalendarandWYearTelegramCalendarthat start from day and month selecting, not from year.You can also redefine style parameters. Example:classMyStyleCalendar(DetailedTelegramCalendar):# previous and next buttons style. they are emoji now!prev_button="⬅️"next_button="➡️"# you do not want empty cells when month and year are being selectedempty_month_button=""empty_year_button=""You will get:Custom Translationyour_translation_months=list('abcdefghijkl')your_translation_days_of_week=list('yourtra')classMyTranslationCalendar(DetailedTelegramCalendar):def__init__(self,**kwargs):super().__init__(**kwargs)self.days_of_week['yourtransl']=your_translation_days_of_weekself.months['yourtransl']=your_translation_monthsExamplessimple_pytelegrambotapi.py- simple example withpyTelegramBotAPIsimple_aiogram.py- simple example withaiogramsimple_telethon.py- simple example withtelethoncustom_translation.py- custom translation of calendardate_ranges.py- define date ranges for the botredefine_style.py- simple example of redefining stylesseveral_calendars.py- several calendars in one botContributingContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make aregreatly appreciated.Fork the ProjectCreate your Feature Branch (git checkout -b feature/yourFeature)Commit your Changes (git commit -m 'Add some yourFeature')Push to the Branch (git push origin feature/yourFeature)Open a Pull RequestAuthorsArtem Bakhanov-@artembakhanovLicenseThis project is licensed under the MIT License - see theLICENSEfile for details