mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 07:50:32 +00:00
aiogram is a modern and fully asynchronous framework for Telegram Bot API written in Python using asyncio
* 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. * get_custom_emoji_stickers docstring fix * Revert compose_data changes * Correctly fixed get_custom_emoji_stickers method |
||
|---|---|---|
| .github | ||
| aiogram | ||
| docs | ||
| examples | ||
| tests | ||
| .gitignore | ||
| .readthedocs.yml | ||
| CODE_OF_CONDUCT.md | ||
| dev_requirements.txt | ||
| environment.yml | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| README.rst | ||
| requirements.txt | ||
| setup.py | ||
| tox.ini | ||
AIOGram
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:
- News: @aiogram_live
- Communities:
- 🇺🇸 @aiogram
- 🇺🇦 @aiogramua
- 🇺🇿 @aiogram_uz
- 🇰🇿 @aiogram_kz
- 🇷🇺 @aiogram_ru
- 🇮🇷 @aiogram_fa
- 🇮🇹 @aiogram_it
- 🇧🇷 @aiogram_br
- PyPI: aiogram
- Documentation: aiogram site
- Source: Github repo
- Issues/Bug tracker: Github issues tracker
- Test bot: @aiogram_bot
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]