ALF bots
Project description
alfbot
Make run bots (for now only Telegram bot available).
You can install the package with the .toml :
pip install e .
The dependencies are coloralf and python-telegram-bot (for now).
For information, none of the functions here ever raise an exception, to not breack a processus : the code print red warning if you raise an Exception of any kind.
But, each function as a raiseException argument that can be turn to True if you want. There is also a global parameters RAISE_EXCEPTION, that can be turn to True.
Bots type
Telegram Bot
To use telegrame bot:
from alfbot import telegram_bot as tbot
tbot.send(text=text, image=image, bot="name_bot_1", uid="name_chat_1")
Arguments text and ìmage can be either str and list of str. For image, the str is the path of the image.
Arguments bot and uid is not required is you set well (like say part "Json file for tokens and ids").
Json file for tokens and ids
Obviously, we need a "secure" file to save your tokens and ids. So all bots need a json file. By default, is "alfbot_params.json", and it's save a the user root (like ~/alfbot_params.json). But you can change this.
First, there is the json file format :
{
"telegram":{
"bots":{
"name_bot_1" : "xxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"name_bot_2" : "xxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"uids":{
"name_chat_1" : "3141592654",
"name_chat_2" : "-1234567899"
}
}
}
All "send" fonction take a default value for bot, uid, and path and name of the json file. You can change easily these value like this (for example just after imports):
PATH_JSON = os.path.expanduser("~/")
DEFAULT_JSON = "alfbot_params.json"
DEFAULT_BOT = "ccalf"
DEFAULT_UID = "alf"
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
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 alfbot-0.1.0.tar.gz.
File metadata
- Download URL: alfbot-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5232a8c9cc9d58f842744cd76b5ec69cbc17e303e8dd5aee75ed9774b24b11c
|
|
| MD5 |
b15eb125d25ac2005604f177936c0ce4
|
|
| BLAKE2b-256 |
463e0947f1d68ecaca49b1bc04939b5db63f7ffa7b22ccb72be25cc189c99084
|
File details
Details for the file alfbot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: alfbot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96fcc467bd4d1fa90b3afc34868b9e40b02888bd3e322cbb709ae5cfcc19fe7f
|
|
| MD5 |
b79c037344401b5aa095831d9b4a34af
|
|
| BLAKE2b-256 |
7bc959386b3c7b425d13ea70799b8c21a8500b635a49df8bff60b2814b5bc3ee
|