Skip to main content

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


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.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

karboai-1.0.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file karboai-1.0.3.tar.gz.

File metadata

  • Download URL: karboai-1.0.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for karboai-1.0.3.tar.gz
Algorithm Hash digest
SHA256 f46487f9e48bda856dd9a75b4c70b37ed1edd7c1b478f106d2badb08717287ad
MD5 5d4ae44d71d5c14f4972b7211608a0d8
BLAKE2b-256 84d39ad7f6c697c217203d227d5caeda737576af8e30b5e18239787aa10713be

See more details on using hashes here.

File details

Details for the file karboai-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: karboai-1.0.3-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

Hashes for karboai-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 86af9e4f17f4ad22bb4b907626b5442692af4971b69ac7e159ca10a40a66ad3b
MD5 a2b2a3ae4d616045ce0b1c0095f00ff1
BLAKE2b-256 9ded3ad4d1dabe4cd2bcf44886d4cb390aa306feaf8b2273c0925a2e0efea2c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page