Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Unofficial Telegram Bot API Library and Client

Project Description

twx.botapi: Unofficial Telegram Bot API Library and Client

contributions:Please join https://github.com/datamachine/twx.botapi
issues:Please use https://github.com/datamachine/twx.botapi/issues
Python version supported:
 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5b

twx.botapi is a python interface for the Telegram bot API. It supports making synchronous and asynchronous calls and converts the response into a usable native python object.

Support for the MTProto API is in the works, but considered pre-alpha right now.

Install

For stable:

pip install twx.botapi

For dev:

pip install -i https://testpypi.python.org/pypi twx.botapi

Documentation

Documentation can be found at http://pythonhosted.org/twx.botapi/

Quick Start

from twx.botapi import TelegramBot, ReplyKeyboardMarkup

"""
Setup the bot
"""

bot = TelegramBot('<API TOKEN>')
bot.update_bot_info().wait()
print(bot.username)

"""
Send a message to a user
"""
user_id = int(<someuserid>)

result = bot.send_message(user_id, 'test message body').wait()
print(result)

"""
Get updates sent to the bot
"""
updates = bot.get_updates().wait()
for update in updates:
    print(update)

"""
Use a custom keyboard
"""
keyboard = [
    ['7', '8', '9'],
    ['4', '5', '6'],
    ['1', '2', '3'],
         ['0']
]
reply_markup = ReplyKeyboardMarkup.create(keyboard)

bot.send_message(user_id, 'please enter a number', reply_markup=reply_markup).wait()
Release History

Release History

This version
History Node

1.0.2

History Node

1.0.1

History Node

1.0.1.dev3

History Node

1.0.1.dev2

History Node

1.0.1.dev1

History Node

1.0

History Node

1.0rc1

History Node

1.0b7.dev2

History Node

1.0b7.dev1

History Node

1.0.dev3

History Node

1.0.dev2

History Node

1.0.dev1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
twx.botapi-1.0.2.tar.gz (14.2 kB) Copy SHA256 Checksum SHA256 Source Jul 5, 2015
twx.botapi-1.0.2.zip (16.9 kB) Copy SHA256 Checksum SHA256 Source Jul 5, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting