Skip to main content

Lightweight telegram bot library.

Project description

TBot

Lightweight telegram bot library for python.


"""example.py"""
from TBot import TBot

BOT = TBot("<token>")
BOT.update_frequence = 0.5  # seconds


@BOT.command("/help")
def help_command(event):
    """Help command handler"""
    BOT.send(event, "Help Message")


@BOT.command("/chat")
def chat(event):
    """Send chat id"""
    group = BOT.get_chat(event)
    if group:
        args = ["title", "type", "id"]
        message = ""
        for i in args:
            message += i.capitalize() + ': ' + str(getattr(group, i)) + "\n"
        BOT.send(event, message)


@BOT.command("*")
def generic(event):
    """Generic command fallback"""
    BOT.send(event, "You said: " + event.text)


BOT.run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Alby7503TBot, version 1.0.9
Filename, size File type Python version Upload date Hashes
Filename, size Alby7503TBot-1.0.9-py3-none-any.whl (16.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Alby7503TBot-1.0.9.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page