mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
docs(readme): prettify readme, update downloads stats badge
This commit is contained in:
parent
4863675d28
commit
4dc285b813
1 changed files with 59 additions and 5 deletions
64
README.md
64
README.md
|
|
@ -4,24 +4,78 @@
|
|||
[![\[Telegram\] aiogram live](https://img.shields.io/badge/telegram-aiogram-blue.svg?style=flat-square)](https://t.me/aiogram_live)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
[](https://pepy.tech/project/aiogram)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
[](https://core.telegram.org/bots/api)
|
||||
[](http://docs.aiogram.dev/en/latest/?badge=latest)
|
||||
[](https://github.com/aiogram/aiogram/issues)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
|
||||
**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.
|
||||
**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 as simple as.
|
||||
|
||||
You can [read the docs here](http://docs.aiogram.dev/en/latest/).
|
||||
|
||||
<details>
|
||||
<summary>📚 Some simple code examples</summary>
|
||||
|
||||
|
||||
First, you should obtain token for your bot from [BotFather](https://t.me/BotFather).
|
||||
|
||||
### Simple [`getMe`](https://core.telegram.org/bots/api#getme) request
|
||||
|
||||
```python
|
||||
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
|
||||
|
||||
```python
|
||||
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/`](https://github.com/aiogram/aiogram/tree/dev-2.x/examples) directory
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## 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)
|
||||
- Pip: [aiogram](https://pypi.python.org/pypi/aiogram)
|
||||
- Docs: [aiogram site](https://docs.aiogram.dev/)
|
||||
- PyPI: [aiogram](https://pypi.python.org/pypi/aiogram)
|
||||
- Documentation: [aiogram site](https://docs.aiogram.dev/en/latest/)
|
||||
- Source: [Github repo](https://github.com/aiogram/aiogram)
|
||||
- Issues/Bug tracker: [Github issues tracker](https://github.com/aiogram/aiogram/issues)
|
||||
- Test bot: [@aiogram_bot](https://t.me/aiogram_bot)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue