Python library for https://karboai.com
Project description
KarboAI
Python library for KarboAI bot development.
Install
pip install karboai
Usage
from karboai import KarboAI, Router, bold
karbo = KarboAI(token="your-token", id="your-bot-id", enable_logging=True)
router = Router()
@router.command("/start")
async def start(ctx):
await karbo.text(ctx.message.chat_id, bold("Welcome!"))
@router.on("message")
async def echo(ctx):
await karbo.text(ctx.message.chat_id, ctx.message.content)
karbo.bind(router)
karbo.attach()
API
| Method | Description |
|---|---|
me() |
Bot info |
text(chat_id, content, reply_message_id?) |
Send text |
image(chat_id, images, reply_message_id?) |
Send images |
upload(buffer, file_name?) |
Upload image, returns URL |
message(chat_id, message_id) |
Get message |
members(chat_id, limit?, offset?) |
Chat members |
user(user_id) |
User info |
leave(chat_id) |
Leave chat |
kick(chat_id, user_id) |
Kick user |
attach(callback?) |
Connect to WebSocket |
bind(*routers) |
Bind routers |
Events
message, join, leave, voiceStart, voiceEnd, sticker
Text formatting
bold(), italic(), centralize(), code(), strikethrough(), underline(), hyperlink(text, url)
Error handling
from karboai import KarboError
try:
await karbo.me()
except KarboError as e:
print(e.status_code, e.name, e)
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
karboai-1.0.6.tar.gz
(6.6 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 karboai-1.0.6.tar.gz.
File metadata
- Download URL: karboai-1.0.6.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73f2130675f7fb29f0c3ed8aeb07842457ccfff15ee3b0ee310da95efaa69b0a
|
|
| MD5 |
14f1a2ad987b38d2a9c5dcff6861728b
|
|
| BLAKE2b-256 |
5cfa1448aeb37b259b0fbaa339e37fbd85f50c1cea51e5844b192b903f4164bc
|
File details
Details for the file karboai-1.0.6-py3-none-any.whl.
File metadata
- Download URL: karboai-1.0.6-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0be6ec15244712b82f474e98b8a122b563ce5a577760f4a791fd9b045c418084
|
|
| MD5 |
912ac3cce17604c19de535dc26b318ec
|
|
| BLAKE2b-256 |
ec957b91e4a2178d24097fd5eed20535a24f5a7955a6850d5415ccfbc86d740c
|