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.
Source Distribution
Alby7503TBot-1.0.7.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for Alby7503TBot-1.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b698112a1575938020c2970ca467ee8ac9885fcd6de2eb5bd074c2df7d5d43a6 |
|
MD5 | 0a23bec20bc6496ce3f66e071424ca15 |
|
BLAKE2b-256 | e6ef69bda9a54300dd869fbc1cc48797b47f90cee3494398e18a51fde411b3e4 |