Skip to content

NicolauMoana/pytgbot

 
 

Repository files navigation

pytgbot - Telegram Bot API 4.0

Python module to access the telegram bot api.

Native python package with a pure Python interface for the Telegram Bot API.

The code is generated directly from the API documentation, meaning up-to-date code is a matter of minutes.

Recent changes

Older changes...

Are you using pytgbot?

If you're using this library to build your Telegram Bots, We'd love to know and share the bot with the world. Tell us about it - here

Check out the Who's using pytgbot wiki page to know more about what people have been building with this library.

Installation

Via pip:

pip install pytgbot

Or manually:

git clone https://github.com/luckydonald/pytgbot.git
cd pytgbot
python setup.py install

Usage

from pytgbot import Bot

bot = Bot(API_KEY)

# sending messages:
bot.send_message(CHAT, "Example Text!")  # CHAT can be a @username or a id

# getting events:
for x in bot.get_updates():
	print(x)

All the functions can be found in the Bot class in the pytgbot/bot.py file. They are pythonic in small letters with underscores instead of camel case, for example getUpdates is bot.get_updates

Examples

Have a look into the examples folder.

In case of errors

First you should set logging to level DEBUG to see what's going on.

# add this to the first lines in your file
import logging
logging.basicConfig(level=logging.DEBUG)

If you are about to open a new issue, search the existing ones (open and closed) first. Sometimes they are already reported or even solved.

About

python module to access the telegram bot api.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 88.8%
  • HTML 11.2%