No project description provided
Project description
Abstract
LeBotTel is an easy to use python package to create your own Telegram bots for different use cases. For details how to use this package refer to the quick start section.
Name
The name LeBotTel is combined from "LeCun", "RoBot" and "Telegram". The "Le" in the name comes from Yann LeCun, to honor his work on neural networks (has nothing to do with this project, but he is a great scientist and pioneer in the field of neural networks (LeNet)). What has this bot to do with neural networks? We want to use this bot to log the training of neural networks. "Bot" comes from RoBot, because this is what the goal of this project is. And "Tel" comes from Telegram, because its a bot for Telegram. The "Pi" in our logo represents looks similar to the "tT" in "LeBotTel" and stands for the used Programming Language Python.
Quick Start
Installation
pip install LeBotTel
Send a message
from LeBotTel import BaseTelegramBot
bot = BaseTelegramBot(token="YOUR_BOT_TOKEN", chat_id="YOUR_CHAT_ID")
bot.send_message("Hello World!") # Raises ChatIdError if chat_id is not set
Hint: To get the chat_id you first have to send your Bot a message (e.g. /start). Then you need to send a GET request to the following URL:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
In the returned JSON you will find the chat_id under message->chat->id.
Send an image
from LeBotTel.base_telegram_bot import BaseTelegramBot
import imageio
import io
bot = BaseTelegramBot(token="YOUR_BOT_TOKEN", chat_id="YOUR_CHAT_ID")
buffer = io.BytesIO()
img = imageio.imread('PATH_TO_IMAGE') # Image has to be in *.png format
imageio.imsave(buffer, img, format="PNG")
bot.send_image(buffer.getvalue()) # Raises ChatIdError if chat_id is not set
Send a gif
from LeBotTel.base_telegram_bot import BaseTelegramBot
import imageio
import io
import glob
bot = BaseTelegramBot(token="YOUR_BOT_TOKEN", chat_id="YOUR_CHAT_ID")
buffer = io.BytesIO()
images = []
image_files = glob.glob('PATH_TO_IMAGES_DIR/*.png') # Images have to be in *.png format
for image_file in image_files:
images.append(imageio.imread(image_file))
imageio.mimsave(buffer, images, format="GIF", duration=30)
bot.send_gif(buffer.getvalue()) # Raises ChatIdError if chat_id is not set
Changelog
- 0.1.0: setup package. Bot can send messages and images
- 0.2.0: Bot can receive messages
- 0.3.0: Add method
export_configto save the current token and chat_id to a file, add classmethodfrom_configto create a bot from the config file, add classmethodfrom_envto create a bot from the environment variablesTELEGRAM_BOT_TOKENandTELEGRAM_CHAT_ID. Methodsimport_chat_idandexport_chat_idare deprecated and will be removed in version 1.0.0 - 0.3.1: Adapting package structure
- 0.4.0: Add
send_gifmethod - 0.4.1: Switch to pyproject.toml for build
Authors
- Antonio Vidos
- Tobias Lettner
- Tobias Weiß
- Uwe Kölbel
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lebottel-0.4.1.tar.gz.
File metadata
- Download URL: lebottel-0.4.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ecae902b2645e08152a8fec6eef9a4741833fcb543ea160503472fd7cd4c27c
|
|
| MD5 |
bca8f543ac4412faa35b40635a351b8e
|
|
| BLAKE2b-256 |
96d373d921047ee93623ff3b83deb6c29a576157b9471edc7f06c0dbd3b23bb7
|
Provenance
The following attestation bundles were made for lebottel-0.4.1.tar.gz:
Publisher:
push_release_to_pypi.yml on tobiweisss/LeBotTel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lebottel-0.4.1.tar.gz -
Subject digest:
4ecae902b2645e08152a8fec6eef9a4741833fcb543ea160503472fd7cd4c27c - Sigstore transparency entry: 151947870
- Sigstore integration time:
-
Permalink:
tobiweisss/LeBotTel@60d7cecf3bbc4ee0ba629a486a4f4fd0e19f00a2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tobiweisss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
push_release_to_pypi.yml@60d7cecf3bbc4ee0ba629a486a4f4fd0e19f00a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file LeBotTel-0.4.1-py3-none-any.whl.
File metadata
- Download URL: LeBotTel-0.4.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91b0d767772e2bab275997c2b321037a524680645206e0d652fbaa6828a0152b
|
|
| MD5 |
bf86108c0388457ac04931f172664323
|
|
| BLAKE2b-256 |
c22df39aed547a185a0729d089418db4e9f18332b40c9ea9ffe65da0ee1a2a9e
|
Provenance
The following attestation bundles were made for LeBotTel-0.4.1-py3-none-any.whl:
Publisher:
push_release_to_pypi.yml on tobiweisss/LeBotTel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lebottel-0.4.1-py3-none-any.whl -
Subject digest:
91b0d767772e2bab275997c2b321037a524680645206e0d652fbaa6828a0152b - Sigstore transparency entry: 151947871
- Sigstore integration time:
-
Permalink:
tobiweisss/LeBotTel@60d7cecf3bbc4ee0ba629a486a4f4fd0e19f00a2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tobiweisss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
push_release_to_pypi.yml@60d7cecf3bbc4ee0ba629a486a4f4fd0e19f00a2 -
Trigger Event:
push
-
Statement type: