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!

Wrapper for Telegram`s Bot API utilizing asyncio

Project Description

Wrapper for Telegram`s Bot API utilizing asyncio

How to use

Here is how you could use it:

from AsyncTelegramBot import BotConversationLoop
from random import randint
import signal

async def conversationEntry(I):
    number = randint(1, 100)

    await I.say("Can you guess my number between 1 and 100?")
    while True:
            answer = await I.gotAnswer()
            if not answer.idsigit():
                    await I.say("Sorry, I did not understand.")
                    continue
            if int(answer) > number:
                    await I.say("Good guess. But that is to high.")
            elif int(answer) < number:
                    await I.say("My number is higher")
            else:
                    await I.say("Correct!")
                    break

    loop = BotConversationLoop("YOUR-API-TOKEN", conversationEntry)
    signal.signal(signal.SIGINT, lambda _, __: loop.shutdown())
    loop.enableDebug()
    loop.startBotPolling()
Release History

Release History

This version
History Node

0.2

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
AsyncTelegramBot-0.2.tar.gz (7.4 kB) Copy SHA256 Checksum SHA256 Source Dec 4, 2016

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