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.8.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for Alby7503TBot-1.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f52caf309c818d668c1b4ebd69b6f0f87168d600b13888ff15909a084c62ea82 |
|
MD5 | afd75f195639f4b121ae32ef3673cd08 |
|
BLAKE2b-256 | eeaeb1d632df186816060f9330e092abc669a8451ab8efb07248b30770a21d90 |