2017-07-29 05:37:13 +03:00
# AIOGram
2017-11-19 00:54:23 +02:00
2019-07-14 18:01:40 -07:00
[](https://opencollective.com/aiogram)
[![\[Telegram\] aiogram live](https://img.shields.io/badge/telegram-aiogram-blue.svg?style=flat-square)](https://t.me/aiogram_live)
2017-11-19 00:47:47 +02:00
[](https://pypi.python.org/pypi/aiogram)
[](https://pypi.python.org/pypi/aiogram)
2018-10-28 20:32:04 +02:00
[](https://pypi.python.org/pypi/aiogram)
2017-11-19 00:47:47 +02:00
[](https://pypi.python.org/pypi/aiogram)
2021-04-28 01:22:57 +03:00
[](https://core.telegram.org/bots/api)
2020-01-01 16:55:33 +02:00
[](http://docs.aiogram.dev/en/latest/?badge=latest)
2017-11-19 00:47:47 +02:00
[](https://github.com/aiogram/aiogram/issues)
[](https://opensource.org/licenses/MIT)
2017-06-03 12:12:56 +03:00
2019-10-14 16:06:35 +03:00
**aiogram** is a pretty simple and fully asynchronous framework for [Telegram Bot API ](https://core.telegram.org/bots/api ) written in Python 3.7 with [asyncio ](https://docs.python.org/3/library/asyncio.html ) and [aiohttp ](https://github.com/aio-libs/aiohttp ). It helps you to make your bots faster and simpler.
2017-06-03 12:12:56 +03:00
2020-09-13 23:11:27 +04:00
## Examples
< details >
< summary > 📚 Click to see some basic examples< / summary >
**Few steps before getting started...**
- First, you should obtain token for your bot from [BotFather ](https://t.me/BotFather ).
- Install latest stable version of aiogram, simply running `pip install aiogram`
### Simple [`getMe`](https://core.telegram.org/bots/api#getme) request
```python
import asyncio
from aiogram import Bot
2021-05-17 20:17:48 +10:00
BOT_TOKEN = ""
2020-09-13 23:11:27 +04:00
async def main():
2021-05-17 20:17:48 +10:00
bot = Bot(token=BOT_TOKEN)
2020-09-13 23:11:27 +04:00
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
```python
import asyncio
from aiogram import Bot, Dispatcher, types
2021-05-17 20:17:48 +10:00
BOT_TOKEN = ""
2020-09-13 23:11:27 +04:00
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():
2021-05-17 20:17:48 +10:00
bot = Bot(token=BOT_TOKEN)
2020-09-13 23:11:27 +04:00
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/` ](https://github.com/aiogram/aiogram/tree/dev-2.x/examples ) directory
< / details >
2017-07-29 05:37:13 +03:00
## Official aiogram resources:
- News: [@aiogram_live ](https://t.me/aiogram_live )
- Community: [@aiogram ](https://t.me/aiogram )
- Russian community: [@aiogram_ru ](https://t.me/aiogram_ru )
2020-09-13 23:11:27 +04:00
- PyPI: [aiogram ](https://pypi.python.org/pypi/aiogram )
- Documentation: [aiogram site ](https://docs.aiogram.dev/en/latest/ )
2017-11-19 00:39:25 +02:00
- Source: [Github repo ](https://github.com/aiogram/aiogram )
- Issues/Bug tracker: [Github issues tracker ](https://github.com/aiogram/aiogram/issues )
2017-07-29 05:37:13 +03:00
- Test bot: [@aiogram_bot ](https://t.me/aiogram_bot )
2019-07-07 09:59:03 -07:00
## Contributors
### Code Contributors
2019-07-17 21:45:19 +03:00
This project exists thanks to all the people who contribute. [[Code of conduct ](CODE_OF_CONDUCT.md )].
2019-07-07 09:59:03 -07:00
< a href = "https://github.com/aiogram/aiogram/graphs/contributors" > < img src = "https://opencollective.com/aiogram/contributors.svg?width=890&button=false" / > < / a >
### Financial Contributors
Become a financial contributor and help us sustain our community. [[Contribute ](https://opencollective.com/aiogram/contribute )]
#### Individuals
< a href = "https://opencollective.com/aiogram" > < img src = "https://opencollective.com/aiogram/individuals.svg?width=890" > < / a >
#### Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute ](https://opencollective.com/aiogram/contribute )]
2020-03-31 10:39:10 +03:00
< a href = "https://opencollective.com/aiogram/organization/0/website" > < img src = "https://opencollective.com/aiogram/organization/0/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/1/website" > < img src = "https://opencollective.com/aiogram/organization/1/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/2/website" > < img src = "https://opencollective.com/aiogram/organization/2/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/3/website" > < img src = "https://opencollective.com/aiogram/organization/3/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/4/website" > < img src = "https://opencollective.com/aiogram/organization/4/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/5/website" > < img src = "https://opencollective.com/aiogram/organization/5/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/6/website" > < img src = "https://opencollective.com/aiogram/organization/6/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/7/website" > < img src = "https://opencollective.com/aiogram/organization/7/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/8/website" > < img src = "https://opencollective.com/aiogram/organization/8/avatar.png" > < / a >
< a href = "https://opencollective.com/aiogram/organization/9/website" > < img src = "https://opencollective.com/aiogram/organization/9/avatar.png" > < / a >