GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sourcesimian/pyTelegramBotAPI: Telegram Bot API (unofficial) in Python 3

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
TelegramBotAPI
TelegramBotAPI
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
makefile
makefile
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 
setup_env.sh
setup_env.sh
 
 

Repository files navigation

Telegram Bot API (unofficial) in Python 3

An implementation of the Telegram Bot API messages and some simple clients.

Used by:

  • aioTelegramBot - An easily customisable bot written in asyncio Python3. * txTelegramBot - An easily customisable bot written in Twisted Python3.

Installation

pip3 install TelegramBotAPI

Usage

Requests Client

from TelegramBotAPI.client.requestsclient import RequestsClient
from TelegramBotAPI.types.methods import getUpdates, sendMessage

# setup
client = RequestsClient(_token)

# send_message
msg = sendMessage()
msg.chat_id = _user_id
msg.text = 'hello there'

resp = client.send_method(msg)
print(resp)


# poll updates
msg = getUpdates()
msg.timeout = _timeout
msg.limit = _limit
msg.offset = last_id + 1

updates = client.send_method(msg)

for update in updates:
    print(update)

Python asyncio Client

import asyncio

from TelegramBotAPI.client.asyncioclient import AsyncioClient
from TelegramBotAPI.types.methods import getUpdates, sendMessage


@asyncio.coroutine
def main():
    client = AsyncioClient(_token)

    # send message
    msg = sendMessage()
    msg.chat_id = _user_id
    msg.text = 'hello there'

    resp = yield from client.send_method(msg)
    print(resp)

    # poll updates
    msg = getUpdates()
    msg.timeout = _timeout
    msg.limit = _limit
    msg.offset = last_id + 1

    updates = yield from client.send_method(msg)

    for update in updates:
        print(update)

About

Telegram Bot API (unofficial) in Python 3

Resources

Readme
MIT license
Activity

Stars

16 stars

Watchers

3 watching

Forks

9 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.