Name | kabforge JSON |
Version |
0.1.3
JSON |
| download |
home_page | None |
Summary | kABForge - khasi AsyncIO Bot Forge: Framework for creating Telegram bots |
upload_time | 2025-08-21 21:39:12 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.11 |
license | MIT |
keywords |
telegram
bot
framework
asyncio
kabforge
aiogram
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Kabforge
Kabforge — это лёгкий и удобный фреймворк для создания Telegram-ботов на Python.
Он создан с целью упростить работу с Telegram Bot API и сделать код максимально чистым и читаемым.
## Установка
```bash
pip install kabforge
```
## Быстрый старт
Пример простого бота:
```python
import asyncio
import logging
import os
from kabforge.client import Bot
from kabforge.dispatcher import Dispatcher
from kabforge.types import Message
logging.basicConfig(level=logging.INFO)
# Токен рекомендуется хранить в переменных окружения
BOT_TOKEN = os.getenv("BOT_TOKEN", "YOUR_BOT_TOKEN_HERE")
bot = Bot(token=BOT_TOKEN)
dp = Dispatcher()
@dp.on_message(command="/start")
async def start_handler(message: Message):
await bot.send_message(chat_id=message.chat_id, text="Hello!")
await message.test()
@dp.on_message(command="t")
async def t_handler(message: Message):
await bot.send_message(chat_id=message.chat_id, text="Text message detected!")
@dp.on_sticker()
async def sticker_handler(message: Message):
await bot.send_message(chat_id=message.chat_id, text="Sticker detected!")
@dp.on_message(command="huy")
async def huy_handler(message: Message):
await message.answer(text="blya")
async def main():
try:
await dp.start_polling(bot)
finally:
await bot.close()
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
print("Бот экстренно выключен")
```
## Возможности
- Простая регистрация хендлеров через декораторы
- Поддержка различных типов апдейтов (сообщения, стикеры и др.)
- Удобная работа с объектами Telegram API
- Асинхронность (asyncio)
## Лицензия
MIT License
Raw data
{
"_id": null,
"home_page": null,
"name": "kabforge",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "telegram, bot, framework, asyncio, kabforge, aiogram",
"author": null,
"author_email": "Aziz Khasanov <runpadshell9@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/22/d3/09dad98fa7207a6c9e1a87c2a382f33a4da0269b526d3aa51c2f23182274/kabforge-0.1.3.tar.gz",
"platform": null,
"description": "# Kabforge\n\nKabforge \u2014 \u044d\u0442\u043e \u043b\u0451\u0433\u043a\u0438\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Telegram-\u0431\u043e\u0442\u043e\u0432 \u043d\u0430 Python. \n\u041e\u043d \u0441\u043e\u0437\u0434\u0430\u043d \u0441 \u0446\u0435\u043b\u044c\u044e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 Telegram Bot API \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0447\u0438\u0441\u0442\u044b\u043c \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c.\n\n## \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\n\n```bash\npip install kabforge\n```\n\n## \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442\n\n\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0431\u043e\u0442\u0430:\n\n```python\nimport asyncio\nimport logging\nimport os\n\nfrom kabforge.client import Bot\nfrom kabforge.dispatcher import Dispatcher\nfrom kabforge.types import Message\n\nlogging.basicConfig(level=logging.INFO)\n\n# \u0422\u043e\u043a\u0435\u043d \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f\nBOT_TOKEN = os.getenv(\"BOT_TOKEN\", \"YOUR_BOT_TOKEN_HERE\")\n\nbot = Bot(token=BOT_TOKEN)\ndp = Dispatcher()\n\n\n@dp.on_message(command=\"/start\")\nasync def start_handler(message: Message):\n await bot.send_message(chat_id=message.chat_id, text=\"Hello!\")\n await message.test()\n\n\n@dp.on_message(command=\"t\")\nasync def t_handler(message: Message):\n await bot.send_message(chat_id=message.chat_id, text=\"Text message detected!\")\n\n\n@dp.on_sticker()\nasync def sticker_handler(message: Message):\n await bot.send_message(chat_id=message.chat_id, text=\"Sticker detected!\")\n\n\n@dp.on_message(command=\"huy\")\nasync def huy_handler(message: Message):\n await message.answer(text=\"blya\")\n\n\nasync def main():\n try:\n await dp.start_polling(bot)\n finally:\n await bot.close()\n\n\nif __name__ == \"__main__\":\n try:\n asyncio.run(main())\n except KeyboardInterrupt:\n print(\"\u0411\u043e\u0442 \u044d\u043a\u0441\u0442\u0440\u0435\u043d\u043d\u043e \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\")\n```\n\n## \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438\n\n- \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0445\u0435\u043d\u0434\u043b\u0435\u0440\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u044b\n- \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0430\u043f\u0434\u0435\u0439\u0442\u043e\u0432 (\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0441\u0442\u0438\u043a\u0435\u0440\u044b \u0438 \u0434\u0440.)\n- \u0423\u0434\u043e\u0431\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 Telegram API\n- \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c (asyncio)\n\n## \u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f\n\nMIT License\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "kABForge - khasi AsyncIO Bot Forge: Framework for creating Telegram bots",
"version": "0.1.3",
"project_urls": null,
"split_keywords": [
"telegram",
" bot",
" framework",
" asyncio",
" kabforge",
" aiogram"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0ee3f52d7dd0fe8b993fca96082ed26ad28b73695c4b25bc37ac327483d56c60",
"md5": "e8268fe56f0af53955370ef0ae71e46a",
"sha256": "7c8b3f3a58ca5b9f4dcaa2dee7a8544735d3be76e4cef38e3e22a3b13a404ca7"
},
"downloads": -1,
"filename": "kabforge-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e8268fe56f0af53955370ef0ae71e46a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 7908,
"upload_time": "2025-08-21T21:39:10",
"upload_time_iso_8601": "2025-08-21T21:39:10.551501Z",
"url": "https://files.pythonhosted.org/packages/0e/e3/f52d7dd0fe8b993fca96082ed26ad28b73695c4b25bc37ac327483d56c60/kabforge-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "22d309dad98fa7207a6c9e1a87c2a382f33a4da0269b526d3aa51c2f23182274",
"md5": "34a30fe0a0ab70d460e5a6430127ab94",
"sha256": "1583a509c41fb74b98664ce4a1ef9f9cdd365a4bdb464ce677cf6cd55057f1ae"
},
"downloads": -1,
"filename": "kabforge-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "34a30fe0a0ab70d460e5a6430127ab94",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 8199,
"upload_time": "2025-08-21T21:39:12",
"upload_time_iso_8601": "2025-08-21T21:39:12.354929Z",
"url": "https://files.pythonhosted.org/packages/22/d3/09dad98fa7207a6c9e1a87c2a382f33a4da0269b526d3aa51c2f23182274/kabforge-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 21:39:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "kabforge"
}