Skip to main content

Telegram Bot Api Client

Project description

tgclient

Telegram Api Client

Getting Started

Install

pip install tgclient

or

git clone https://github.com/negative23/tgclient.git
cd tgclient 

python setup.py install

getupdates example

from tgclient import *

bot = TelegramBot("245100736:AAGpgrDLt1YNwsQxxxxxxxxxxxxxxxxxxxx")


@bot.message("text")
def text(message):
    print(message)
    # {'message_id': 6577, 'from': {'id': 68747297, ... ...

bot.run()

command handler

from tgclient import *

bot = TelegramBot("245100736:AAGpgrDLt1YNwsQxxxxxxxxxxxxxxxxxxxx")


@bot.command(r'^(/echo) (.*)')
def text(message, args):
    # args[2] two argument of command
    bot.sendMessage(message['chat']['id'], args[1])

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

tgclient-1.5.3.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

tgclient-1.5.3-py3-none-any.whl (13.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page