Skip to main content

Simple Inline Calendar & Date Selection tool for Aiogram Telegram bots

Project description

Date Selection tool for Aiogram Telegram Bots

Description

A simple inline calendar, date selection tool for aiogram telegram bots written in Python.

Offers two types of date pickers:

Navigation calendar - user can either select a date or move to the next or previous month/year by clicking a singe button.

Dialog calendar - user selects year on first stage, month on next stage, day on last stage.

From version 0.2 supports aiogram 3, use version 0.1.1 with aiogram 2.

Usage

Install package

pip install aiogram_calendar

A full working example on how to use aiogram-calendar is provided in *bot_example.py*.

In example keyboard with buttons is created.

Each button triggers a calendar in a different way by adding it to a message with a reply_markup.

reply_markup=await  SimpleCalendar().start_calendar()

^^ will reply with a calendar created using English localization (months and days of week captions). Locale can be overridden by passing locale argument:

reply_markup=await  SimpleCalendar(locale='uk_UA').start_calendar()

or by getting locale from User data provided by telegram API using get_user_locale method by passing message.from_user to it

reply_markup=await  SimpleCalendar(locale=await  get_user_locale(message.from_user)).start_calendar()

Depending on what button of calendar user will press callback is precessed using the process_selection method.

selected, date  =  await  SimpleCalendar(locale=await  get_user_locale(callback_query.from_user)).process_selection(callback_query, callback_data)

Here locale is specified from callback_query.from_user

Gif demo:

aiogram_calendar

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiogram_calendar-0.4.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiogram_calendar-0.4.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file aiogram_calendar-0.4.0.tar.gz.

File metadata

  • Download URL: aiogram_calendar-0.4.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for aiogram_calendar-0.4.0.tar.gz
Algorithm Hash digest
SHA256 54eef08806279a0b17dfee2fae17eb8699ff08891b3848010f4d00a5d2c0433b
MD5 139ef4c7253ae4909081734e42cf6b27
BLAKE2b-256 55108ca4b19c5b8f8174db1b8994d4cc553c5801698e1029d8a1c10d6d276a4a

See more details on using hashes here.

File details

Details for the file aiogram_calendar-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aiogram_calendar-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1cf91997a2084171ed13c9a5c690bc5a85d1fdf3932fcd8784a6b79b2b44de9
MD5 bc8a230f0f1766978bd70ed1898cf4f1
BLAKE2b-256 d82479f1de2ef2e7fce70ae2134056c4a9b8597e0492cae68ce446b8f1c1309f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page