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.6.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for Alby7503TBot-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b74d544a9f105010f082a4553d38c719091f2f46414ddd5263ef8d87702202fa |
|
MD5 | 5e7ea1d8631efea3261c44df11ec0494 |
|
BLAKE2b-256 | 6324058326d59dfbabee6a886076f4b318555404a367b437a79a92b3127ee9c0 |