aiogram is a modern and fully asynchronous framework for Telegram Bot API written in Python using asyncio
Find a file
ENCRYPTED 492657b1e9
Fixed possible incorrect escaping of list[str].
By default if you call str() on collection python will escape strings inside of it using single quotes, which will cause "Can't parse custom emoji identifiers json object" error when calling getCustomEmojiStickers.
json.dumps() escapes strings by double quotes so no error occurs.
2022-09-17 21:08:59 +03:00
.github Split "Context" textarea field into several required input fields (#962) 2022-07-23 21:27:22 +03:00
aiogram Fixed possible incorrect escaping of list[str]. 2022-09-17 21:08:59 +03:00
docs Added full support of Bot API 6.2 2022-08-13 23:01:10 +03:00
examples Use hardcoded token as in the other examples (#809) 2022-01-26 23:25:40 +02:00
tests Patch 2 (#977) 2022-08-14 18:29:35 +03:00
.gitignore add simple tests for RedisStorage2 2020-02-12 20:28:45 +02:00
.readthedocs.yml Try use new .readthedocs.yml config. 2019-04-18 21:18:17 +03:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2018-09-28 16:47:44 +03:00
dev_requirements.txt Сleanup storage (#587) 2021-06-13 01:22:47 +03:00
environment.yml Try to change conda channels. 2018-09-08 00:25:48 +03:00
LICENSE Bump license: Year. 2018-05-05 14:37:54 +03:00
Makefile Added support of Telegram BOt API 6.0 2022-04-16 18:09:58 +03:00
README.md Update README.md 2022-08-24 00:41:42 +03:00
README.rst Update README.rst 2022-08-24 00:40:13 +03:00
requirements.txt Dev 2.x api 5.4 (#741) 2021-11-07 01:39:51 +02:00
setup.py fix: setup.py (#856) 2022-03-05 02:34:53 +02:00
tox.ini Fix tests 2020-11-08 17:57:02 +02:00

AIOGram

Financial Contributors on Open Collective [Telegram] aiogram live PyPi Package Version PyPi status Downloads Supported python versions Telegram Bot API Documentation Status Github issues MIT License

aiogram is a pretty simple and fully asynchronous framework for Telegram Bot API written in Python 3.7 with asyncio and aiohttp. It helps you to make your bots faster and simpler.

Examples

📚 Click to see some basic examples

Few steps before getting started...

  • First, you should obtain token for your bot from BotFather.
  • Install latest stable version of aiogram, simply running pip install aiogram

Simple getMe request

import asyncio
from aiogram import Bot

BOT_TOKEN = ""

async def main():
    bot = Bot(token=BOT_TOKEN)

    try:
        me = await bot.get_me()
        print(f"🤖 Hello, I'm {me.first_name}.\nHave a nice Day!")
    finally:
        await bot.close()

asyncio.run(main())

Poll BotAPI for updates and process updates

import asyncio
from aiogram import Bot, Dispatcher, types

BOT_TOKEN = ""

async def start_handler(event: types.Message):
    await event.answer(
        f"Hello, {event.from_user.get_mention(as_html=True)} 👋!",
        parse_mode=types.ParseMode.HTML,
    )

async def main():
    bot = Bot(token=BOT_TOKEN)
    try:
        disp = Dispatcher(bot=bot)
        disp.register_message_handler(start_handler, commands={"start", "restart"})
        await disp.start_polling()
    finally:
        await bot.close()

asyncio.run(main())

Moar!

You can find more examples in examples/ directory

Official aiogram resources:

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Code of conduct].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]