Robogram 🤖📨️ - Telegram Bot API
robogram is an (unofficial) Minimal Telegram Bot API Wrapper to send messages on Telegram - to user, channel, or group.
The only dependency is requests – with over 50K stars on GitHub.
Install
robogram is available on PyPI, and can be installed with pip:
$ pip install robogram
You’ll also need to obtain an Bot Token as outlined in the docs.
Usage
Use a TeleBot to send a message to a personal chat, channel, or group on Telegram:
from robogram import TeleBot
# Authentication token, that you get by:
# (1) opening a chat with `@BotFather`
# (2) using command `/newbot` to create a new bot
BOT_TOKEN = 'TOKEN'
# Chat ID, that you get by:
# (1) Add the new bot to personal chat, channel, or group
# (2) Send a message to bot
CHAT_ID = -123456789
bot = TeleBot(BOT_TOKEN)
r = bot.send_message(CHAT_ID, 'Hello World!')
print(r)
Looking for an easier way to get the Chat ID for a personal chat, channel, or group?
Follow steps above, and add the Bot to chat. Then use TeleBot.get_chat_ids_from_updates, a convenience wrapper around /getUpdates:
import json
# Get a mapping of Chat ID to Chat Type/Title,
# based on `/getUpdates` response.
#
# Example Response:
# {
# 12345: '[PRIVATE] User321',
# -97531: '[CHANNEL] My Channel',
# }
chat_id_to_title = bot.get_chat_ids_from_updates()
print(json.dumps(chat_id_to_title, indent=2))
To get info on the TeleBot associated with the token:
me = bot.get_me()
print(json.dumps(me, indent=2))
Credits
This package was created with Cookiecutter and the rnag/cookiecutter-pypackage project template.
History
0.1.0 (2024-06-20)
First release on PyPI.
Metadata
Release files for robogram 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| robogram-0.1.0.tar.gz | 14.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| robogram-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 21.7 kB
Release files / robogram-0.1.0.tar.gz
| Download URL | robogram-0.1.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fccebf5fbf362ee893ede613caf56b001ab9a1fdb1a73312092143ec07f64f59
|
|
BLAKE2b-256 checksum How to use checksums |
93e62cc0d28326d2873dd82cc6e201cd440da51150751427027d5cbf3edac93d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / robogram-0.1.0-py2.py3-none-any.whl
| Download URL | robogram-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
13e412b35311a1ce4c2f416d31693dfecacb128e823691ce4d3b43072fe17561
|
|
BLAKE2b-256 checksum How to use checksums |
253889d10c2d2a317d72f138351186fc85aeb46c50f79f1a98b5b3f0e3b4f1f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for robogram 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.