Skip to content

i-Naji/demo-pytdlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

demo-pytdlib

pyTDLib - python bindings for TDLib (Telegram Database Library) JSON API: https://github.com/tdlib/td

Installation

You first need to install

then

python3 setup.py

Example:

from pytdlib import Client
from pytdlib.api.types import updateNewMessage, messageText

bot = Client()

bot.start(login=True)

def updt_hndlr(update):
    if isinstance(update, updateNewMessage):
        msg = update.message
        if isinstance(msg.content, messageText):
            text = msg.content.text.text

            if text == "ping":
                bot.send_message(msg.chat_id, "*PING*", reply_to_message_id=msg.id, parse_mode="md", action=True)

bot.set_update_handler(updt_hndlr)
#bot.idle()

About

Python bindings and client for TDLib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages