aiogram-calendar


Nameaiogram-calendar JSON
Version 0.5.0 PyPI version JSON
download
home_page
SummarySimple Inline Calendar & Date Selection tool for Aiogram Telegram bots
upload_time2023-12-06 22:32:51
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) 2018 noXplode Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords aiogram telegram bots calendar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
  

# Date Selection tool for Aiogram Telegram Bots

  

  

## Description

  

A simple inline calendar, date selection tool for [aiogram](https://github.com/aiogram/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.**

  
## Main features
- Two calendars with abilities to navigate years, months, days altogether or in dialog
- Ability to set specified locale (language of captions) or inherit from user`s locale
- Limiting the range of dates to select from
- Highlighting todays date 
  

## 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](https://j.gifs.com/nRQlqW.gif)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "aiogram-calendar",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "Aiogram,Telegram,Bots,Calendar",
    "author": "",
    "author_email": "Andrii Nikolabai <nikolabay.as@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e2/ba/4e8c40ab1bcd15fd3627de0b03c72fd4cd43a1bca50e61ab2fba94cd1742/aiogram_calendar-0.5.0.tar.gz",
    "platform": null,
    "description": "\r\n  \r\n\r\n# Date Selection tool for Aiogram Telegram Bots\r\n\r\n  \r\n\r\n  \r\n\r\n## Description\r\n\r\n  \r\n\r\nA simple inline calendar, date selection tool for [aiogram](https://github.com/aiogram/aiogram) telegram bots written in Python.\r\n\r\n  \r\n\r\nOffers two types of date pickers:\r\n\r\n  \r\n\r\nNavigation calendar - user can either select a date or move to the next or previous month/year by clicking a singe button.\r\n\r\n  \r\n\r\nDialog calendar - user selects year on first stage, month on next stage, day on last stage.\r\n\r\n  \r\n\r\n  \r\n\r\n**From version 0.2 supports aiogram 3, use version 0.1.1 with aiogram 2.**\r\n\r\n  \r\n## Main features\r\n- Two calendars with abilities to navigate years, months, days altogether or in dialog\r\n- Ability to set specified locale (language of captions) or inherit from user`s locale\r\n- Limiting the range of dates to select from\r\n- Highlighting todays date \r\n  \r\n\r\n## Usage\r\n\r\n  \r\n\r\nInstall package\r\n\r\n  \r\n\r\n  \r\n\r\npip install aiogram_calendar\r\n\r\n  \r\n\r\n  \r\n\r\nA full working example on how to use aiogram-calendar is provided in *`bot_example.py*`.\r\n\r\n  \r\n\r\n  \r\n\r\nIn example keyboard with buttons is created.\r\n\r\n  \r\n\r\nEach button triggers a calendar in a different way by adding it to a message with a *reply_markup*.\r\n\r\n  \r\n\r\nreply_markup=await SimpleCalendar().start_calendar()\r\n\r\n^^ will reply with a calendar created using English localization (months and days of week captions). Locale can be overridden by passing locale argument:\r\n\r\n  \r\n\r\nreply_markup=await SimpleCalendar(locale='uk_UA').start_calendar()\r\n\r\nor by getting locale from User data provided by telegram API using get_user_locale method by passing `message.from_user` to it\r\n\r\n  \r\n\r\nreply_markup=await SimpleCalendar(locale=await get_user_locale(message.from_user)).start_calendar()\r\n\r\n  \r\n\r\nDepending on what button of calendar user will press callback is precessed using the *process_selection* method.\r\n\r\n  \r\n\r\nselected, date = await SimpleCalendar(locale=await get_user_locale(callback_query.from_user)).process_selection(callback_query, callback_data)\r\n\r\nHere locale is specified from `callback_query.from_user`\r\n\r\n  \r\n\r\n  \r\n\r\n## Gif demo:\r\n\r\n  \r\n\r\n  \r\n\r\n![aiogram_calendar](https://j.gifs.com/nRQlqW.gif)\r\n",
    "bugtrack_url": null,
    "license": "MIT License Copyright (c) 2018 noXplode Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Simple Inline Calendar & Date Selection tool for Aiogram Telegram bots",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://github.com/noXplode/aiogram_calendar"
    },
    "split_keywords": [
        "aiogram",
        "telegram",
        "bots",
        "calendar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "54c9c27cafbab53c72ec14af24b89408d6fbeff50fd529956d8eb8b041883b52",
                "md5": "64905acaa76376b1931f3a30c218ac4b",
                "sha256": "73b1f900b946aea51e54ba0049cdd308ec775d1cb028599fcebd89fd38a0ff61"
            },
            "downloads": -1,
            "filename": "aiogram_calendar-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64905acaa76376b1931f3a30c218ac4b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12673,
            "upload_time": "2023-12-06T22:31:46",
            "upload_time_iso_8601": "2023-12-06T22:31:46.271496Z",
            "url": "https://files.pythonhosted.org/packages/54/c9/c27cafbab53c72ec14af24b89408d6fbeff50fd529956d8eb8b041883b52/aiogram_calendar-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2ba4e8c40ab1bcd15fd3627de0b03c72fd4cd43a1bca50e61ab2fba94cd1742",
                "md5": "1083132638398c4e0694da1eb355616e",
                "sha256": "49d76bd55ccfbc5d2c1cb0866636a626d57ea09052fdf10ce62dd39162aa4225"
            },
            "downloads": -1,
            "filename": "aiogram_calendar-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1083132638398c4e0694da1eb355616e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10917,
            "upload_time": "2023-12-06T22:32:51",
            "upload_time_iso_8601": "2023-12-06T22:32:51.051476Z",
            "url": "https://files.pythonhosted.org/packages/e2/ba/4e8c40ab1bcd15fd3627de0b03c72fd4cd43a1bca50e61ab2fba94cd1742/aiogram_calendar-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-06 22:32:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "noXplode",
    "github_project": "aiogram_calendar",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "aiogram-calendar"
}
        
Elapsed time: 0.14488s