Python Telegram Bot Api Wrapper.
Project description
telegrambotapiwrapper
Python Telegram Bot API wrapper
What is telegrambotapiwrapper?
telegramapiwrapper
is the simplest Telegram Bot Api wrapper for Python among existing wrappers.
Requirements
Python 3.7
Installation
pip install telegrambotapiwrapper
Getting started.
Создание бота
Вы должны создать бота и получить токен
Testing your bot's auth token
Воспользуемся методом getMe
>>> from telegrambotapiwrapper.wrapper import Api
>>> bot_api = Api(token="<paste here your token>")
>>> me = bot_api.get_me()
>>> me
User(id=123456679, is_bot=True, first_name='botbotbot', last_name=None, username='myrudatingposterbot', language_code=None)
>>> from telegrambotapiwrapper.typelib import User
>>> isinstance(me, User)
True
Sending text message
Sending audio file
Sending
Writing first bot
# firstbot.py
from telegrambotapiwrapper.wrapper import Api
from telegrambotapiwrapper.typelib import User
TOKEN = "<past_your_bot_api_token>"
bot_api = Api(token=TOKEN)
me = bot_api.get_me()
print("me: {}".format(me))
print("isinstance(me, User): {}".format(isinstance(me, User))) # see type of result
Result:
(venv) dzmitry@mycomp:~$ python3 firstbot.py
me: User(id=123456789, is_bot=True, first_name='myrfffrbot', last_name=None, username='myrfffrbot', language_code=None)
isinstance(me, User): True
(venv) dzmitry@mycomp:~$
Examples
Setting webhook
Sending message
Sending file
Using proxies
License
MIT License Copyright (c) 2019 Dzmitry Maliuzhenets
See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for telegrambotapiwrapper-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2aff9e0dadd79609805a232833c2584f83fad99594e6f69dd893cfa781e99de |
|
MD5 | d59fc55b8e6097a12f3093c65001ea2d |
|
BLAKE2b-256 | d23dd7569e4811eae5609b3a3440bf7722da9c3529e08129d1c1f7c622b520fa |
Close
Hashes for telegrambotapiwrapper-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11d2c5c7bf8b1a10c5494b718c95306eb9e2098a83b03c9f647dd91893527ada |
|
MD5 | d9468bb98e69fa2a93a719102a029627 |
|
BLAKE2b-256 | a9bf68e288dd9207766c11bbc2d8c0389892c55e7f8e84b6cacc905b77c46c04 |