aiogram is a modern and fully asynchronous framework for Telegram Bot API written in Python using asyncio
Find a file
Oleg A 24fb07d3fe
Bot API 5.1 (#519)
* version update

* added ChatMemberUpdated class

* added ChatInviteLink class

* 2.x version update

* update types added

* added methods createChatInviteLink,  editChatInviteLink,  revokeChatInviteLink

* Voice Chat types added

* added Message fields: voice_chat_started, voice_chat_ended, voice_chat_participants_invited

* can_manage_voice_chats added

* chat links shortcuts added

* bowling dice support

* reordered ChatMembers params (no changes)

* Added can_manage_chat to the class ChatMember and parameter can_manage_chat to the method promoteChatMember

* kick_chat_member refactored + docs update

* Added the parameter revoke_messages to the method kickChatMember

* updated kick_chat_member shortcut for Chat

* Added the type MessageAutoDeleteTimerChanged and the field message_auto_delete_timer_changed to the class Message

* feat: add methods to register my_chat_member and chat_member handlers

* Updated filters for new event types

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2021-03-14 18:05:17 +02:00
.github Update FUNDING.yml 2019-12-04 18:11:03 +02:00
aiogram Bot API 5.1 (#519) 2021-03-14 18:05:17 +02:00
docs docs(install): typo "form" -> "from" (#498) 2021-01-22 09:49:46 +02:00
examples Update chat_type_filter.py 2021-02-09 15:31:46 +00:00
tests pytest update; yield_fixture deprecation fix; event_loop removed (#479) 2021-01-10 20:53:59 +02: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 pytest update; yield_fixture deprecation fix; event_loop removed (#479) 2021-01-10 20:53:59 +02: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 Fix italic and underline decorations 2020-09-13 22:56:32 +03:00
README.md Telegram API readme updated (#463) 2020-11-12 22:02:52 +02:00
README.rst Bot API 5.0 (#454) 2020-11-08 17:51:39 +02:00
requirements.txt Bot API 5.0 (#454) 2020-11-08 17:51:39 +02:00
setup.py Bot API 5.0 (#454) 2020-11-08 17:51:39 +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


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

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]