Library for Collaps Chat bots (Telegram-style), pure stdlib
Project description
collaps-bot
Библиотека для ботов Collaps Chat — в стиле python-telegram-bot, без зависимостей (только стандартная библиотека Python 3).
Установка
pip install collaps-bot
Быстрый старт
Токен берётся в BotFather (botfather.html), формат <botId>:<secret>.
from collaps_bot import CollapsBot
bot = CollapsBot("ВСТАВЬ_ТОКЕН")
@bot.command("start")
def start(u):
u.reply("Привет! Я бот на Python 🐍")
@bot.command("help")
def help_cmd(u):
u.reply("Команды: /start /help /echo")
@bot.command("echo")
def echo_cmd(u):
u.reply(" ".join(u.args) or "Напишите текст после /echo")
@bot.message
def fallback(u):
u.reply("Вы написали: " + u.text)
bot.run()
API
CollapsBot(token, db_url=..., poll_interval=2.0)@bot.command("name")— обработчик команды/name@bot.message— обработчик остальных сообщенийbot.send_message(chat_id, text)bot.run()— запуск polling-цикла- в обработчике доступны:
u.text,u.args,u.command,u.sender_id,u.sender_name,u.chat_id,u.reply(...)
Лицензия
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
collaps_bot-0.1.0.tar.gz
(4.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file collaps_bot-0.1.0.tar.gz.
File metadata
- Download URL: collaps_bot-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9289622f93de71350af179ebf267e6e5796e2af852ccf09ae6c6b4144aeece83
|
|
| MD5 |
1933e23135a3b531f83a3c0ba910e5e1
|
|
| BLAKE2b-256 |
9a9e29c23df108dc0d2406255008764b6bc46025c2d121c1fa145c7cc26e8f9d
|
File details
Details for the file collaps_bot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: collaps_bot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e18fc53fb50f641370e98db17bc355d781969a768a4aa0d54754071c61f59b
|
|
| MD5 |
9f8f886c53c95050aa324bcec9f4d25c
|
|
| BLAKE2b-256 |
1550c21daadfd5bfde96e6f8223e7ee8c4e97ef53921033691d6f74fa15ca01f
|