Renovate
c99f22b1b8
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [pillow](https://github.com/python-pillow/Pillow) ([changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)) | minor | `~=10.2.0` -> `~=10.3.0` | --- ### Release Notes <details> <summary>python-pillow/Pillow (pillow)</summary> ### [`v10.3.0`](https://github.com/python-pillow/Pillow/blob/HEAD/CHANGES.rst#1030-2024-04-01) [Compare Source](https://github.com/python-pillow/Pillow/compare/10.2.0...10.3.0) - CVE-2024-28219: Use `strncpy` to avoid buffer overflow [#​7928](https://github.com/python-pillow/Pillow/issues/7928) \[radarhere, hugovk] - Deprecate `eval()`, replacing it with `lambda_eval()` and `unsafe_eval()` [#​7927](https://github.com/python-pillow/Pillow/issues/7927) \[radarhere, hugovk] - Raise `ValueError` if seeking to greater than offset-sized integer in TIFF [#​7883](https://github.com/python-pillow/Pillow/issues/7883) \[radarhere] - Add `--report` argument to `__main__.py` to omit supported formats [#​7818](https://github.com/python-pillow/Pillow/issues/7818) \[nulano, radarhere, hugovk] - Added RGB to I;16, I;16L, I;16B and I;16N conversion [#​7918](https://github.com/python-pillow/Pillow/issues/7918), [#​7920](https://github.com/python-pillow/Pillow/issues/7920) \[radarhere] - Fix editable installation with custom build backend and configuration options [#​7658](https://github.com/python-pillow/Pillow/issues/7658) \[nulano, radarhere] - Fix putdata() for I;16N on big-endian [#​7209](https://github.com/python-pillow/Pillow/issues/7209) \[Yay295, hugovk, radarhere] - Determine MPO size from markers, not EXIF data [#​7884](https://github.com/python-pillow/Pillow/issues/7884) \[radarhere] - Improved conversion from RGB to RGBa, LA and La [#​7888](https://github.com/python-pillow/Pillow/issues/7888) \[radarhere] - Support FITS images with GZIP\_1 compression [#​7894](https://github.com/python-pillow/Pillow/issues/7894) \[radarhere] - Use I;16 mode for 9-bit JPEG 2000 images [#​7900](https://github.com/python-pillow/Pillow/issues/7900) \[scaramallion, radarhere] - Raise ValueError if kmeans is negative [#​7891](https://github.com/python-pillow/Pillow/issues/7891) \[radarhere] - Remove TIFF tag OSUBFILETYPE when saving using libtiff [#​7893](https://github.com/python-pillow/Pillow/issues/7893) \[radarhere] - Raise ValueError for negative values when loading P1-P3 PPM images [#​7882](https://github.com/python-pillow/Pillow/issues/7882) \[radarhere] - Added reading of JPEG2000 palettes [#​7870](https://github.com/python-pillow/Pillow/issues/7870) \[radarhere] - Added alpha_quality argument when saving WebP images [#​7872](https://github.com/python-pillow/Pillow/issues/7872) \[radarhere] - Fixed joined corners for ImageDraw rounded_rectangle() non-integer dimensions [#​7881](https://github.com/python-pillow/Pillow/issues/7881) \[radarhere] - Stop reading EPS image at EOF marker [#​7753](https://github.com/python-pillow/Pillow/issues/7753) \[radarhere] - PSD layer co-ordinates may be negative [#​7706](https://github.com/python-pillow/Pillow/issues/7706) \[radarhere] - Use subprocess with CREATE_NO_WINDOW flag in ImageShow WindowsViewer [#​7791](https://github.com/python-pillow/Pillow/issues/7791) \[radarhere] - When saving GIF frame that restores to background color, do not fill identical pixels [#​7788](https://github.com/python-pillow/Pillow/issues/7788) \[radarhere] - Fixed reading PNG iCCP compression method [#​7823](https://github.com/python-pillow/Pillow/issues/7823) \[radarhere] - Allow writing IFDRational to UNDEFINED tag [#​7840](https://github.com/python-pillow/Pillow/issues/7840) \[radarhere] - Fix logged tag name when loading Exif data [#​7842](https://github.com/python-pillow/Pillow/issues/7842) \[radarhere] - Use maximum frame size in IHDR chunk when saving APNG images [#​7821](https://github.com/python-pillow/Pillow/issues/7821) \[radarhere] - Prevent opening P TGA images without a palette [#​7797](https://github.com/python-pillow/Pillow/issues/7797) \[radarhere] - Use palette when loading ICO images [#​7798](https://github.com/python-pillow/Pillow/issues/7798) \[radarhere] - Use consistent arguments for load_read and load_seek [#​7713](https://github.com/python-pillow/Pillow/issues/7713) \[radarhere] - Turn off nullability warnings for macOS SDK [#​7827](https://github.com/python-pillow/Pillow/issues/7827) \[radarhere] - Fix shift-sign issue in Convert.c [#​7838](https://github.com/python-pillow/Pillow/issues/7838) \[r-barnes, radarhere] - Open 16-bit grayscale PNGs as I;16 [#​7849](https://github.com/python-pillow/Pillow/issues/7849) \[radarhere] - Handle truncated chunks at the end of PNG images [#​7709](https://github.com/python-pillow/Pillow/issues/7709) \[lajiyuan, radarhere] - Match mask size to pasted image size in GifImagePlugin [#​7779](https://github.com/python-pillow/Pillow/issues/7779) \[radarhere] - Release GIL while calling `WebPAnimDecoderGetNext` [#​7782](https://github.com/python-pillow/Pillow/issues/7782) \[evanmiller, radarhere] - Fixed reading FLI/FLC images with a prefix chunk [#​7804](https://github.com/python-pillow/Pillow/issues/7804) \[twolife] - Update wl-paste handling and return None for some errors in grabclipboard() on Linux [#​7745](https://github.com/python-pillow/Pillow/issues/7745) \[nik012003, radarhere] - Remove execute bit from `setup.py` [#​7760](https://github.com/python-pillow/Pillow/issues/7760) \[hugovk] - Do not support using test-image-results to upload images after test failures [#​7739](https://github.com/python-pillow/Pillow/issues/7739) \[radarhere] - Changed ImageMath.ops to be static [#​7721](https://github.com/python-pillow/Pillow/issues/7721) \[radarhere] - Fix APNG info after seeking backwards more than twice [#​7701](https://github.com/python-pillow/Pillow/issues/7701) \[esoma, radarhere] - Deprecate ImageCms constants and versions() function [#​7702](https://github.com/python-pillow/Pillow/issues/7702) \[nulano, radarhere] - Added PerspectiveTransform [#​7699](https://github.com/python-pillow/Pillow/issues/7699) \[radarhere] - Add support for reading and writing grayscale PFM images [#​7696](https://github.com/python-pillow/Pillow/issues/7696) \[nulano, hugovk] - Add LCMS2 flags to ImageCms [#​7676](https://github.com/python-pillow/Pillow/issues/7676) \[nulano, radarhere, hugovk] - Rename x64 to AMD64 in winbuild [#​7693](https://github.com/python-pillow/Pillow/issues/7693) \[nulano] </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4zNS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMzUuMCIsInRhcmdldEJyYW5jaCI6ImRldiJ9--> Reviewed-on: #76 Co-authored-by: Renovate <renovate@git.end-play.xyz> Co-committed-by: Renovate <renovate@git.end-play.xyz> |
||
---|---|---|
classes | ||
docs | ||
locale | ||
modules | ||
plugins | ||
.gitignore | ||
.renovaterc | ||
config_example.json | ||
LICENSE | ||
loop.bat | ||
loop.sh | ||
main.py | ||
README_uk.md | ||
README.md | ||
requirements.txt | ||
start.bat | ||
start.sh |
TelegramPoster
Шукаєш інструкцію українською? А вона ось тут знаходиться)
This bot is used for one and only task - post pictures from my personal archive. Here's its source code so you can also host a bot and have fun with it. Just don't exepect it to be brilliant. It is not. But hey, you can always fork it ;)
Dependencies
- Python 3.8+ (3.9+ recommended)
- MongoDB
- PhotosAPI
Use MongoDB's installation manual and Photos API's README.
Please note that Photos API also requires MongoDB so it makes sense to install and configure Mongo first.
Installation
To make this bot run at first you need to have a Python interpreter, Photos API, MongoDB and optionally git (if you want to update using git pull
). You can also ignore git and simply download source code, should also work fine. After that you're ready to go.
In this README I assume that you're using default python in your system and your system's PATH contains it. If your default python is
python3
or for example/home/user/.local/bin/python3.9
- use it instead. If it's non-standard executable path - you should also change it in scripts you will use (loop.sh
,loop.bat
,start.sh
andstart.bat
).
-
Install MongoDB and Photos API:
- Install MongoDB by following official installation manual
- Install Photos API by following Photos API's README
-
Download the bot:
git clone -b dev https://git.end-play.xyz/profitroll/TelegramPoster.git
(if you're using git)cd TelegramPoster
-
Create virtual environment [Optional]:
- Install virtualenv module:
pip install virtualenv
- Create venv:
python -m venv .venv
- Activate it using
source .venv/bin/activate
on Linux,.venv\Scripts\activate.bat
in CMD or.venv\Scripts\Activate.ps1
in PowerShell.
- Install virtualenv module:
-
Install project's dependencies:
python -m pip install -r requirements.txt
Without installing those - bot cannot work at all. -
Configure required keys with your favorite text editor:
- Copy config file:
cp config_example.json config.json
- Open
config.json
using your favorite text editor. For examplenano config.json
, but you can also edit it with vim, mcedit, or Notepad/Notepad++ on Windows - Change
"bot.owner"
,"bot.api_id"
,"bot.api_hash"
and"bot.bot_token"
keys' values.
If you don't know where to find bot_token and your id - here you can find some hints: get bot token, get your id, get api_hash and api_id.
- Copy config file:
-
Configure database and API:
-
Configure database:
- Change database host and port in keys
"database.host"
and"database.port"
. For default local installation those will be127.0.0.1
and27017
respectively - Change database name to the one you like in
"database.name"
. It will be automatically created on start - If you've changed user and password to access the db, you should also change
"database.user"
and"database.password"
keys, otherwise leave themnull
(default).
- Change database host and port in keys
-
Configure Photos API:
- Change
"posting.api.address"
and"posting.api.address_external"
to the ones your API server uses - Run your bot using
python main.py --create-user --create-album
to configure its new user and album. You can also use manual user and album creation described in the wiki. You can also change username, password and album in"posting.api"
to the user and album you have if you already have Photos API album and user set up. In that case you don't need to create a new one.
- Change
-
-
Add bot to the channel:
To use your bot of course you need to have a channel or group otherwise it makes no sense to have such a bot. Here you can find a quick guide how to add your bot to a channel. After that simply set
"posting.channel"
to your channel's ID and"posting.comments"
to comments group's ID. -
Configure posting time:
To make your bot post random content you need to configure
"posting.time"
with a list of "DD:MM" formatted strings or use"posting.interval"
formatted as "XdXhXmXs". To use interval instead of selected time, set"posting.use_interval"
totrue
. -
Good to go, run it!
Make sure MongoDB and Photos API are running and use
python main.py
to start the bot.
Or you can also use.\start.bat
on Windows andbash ./start.sh
on Linux.
Additionally there areloop.sh
andloop.bat
available if you want your bot to start again after being stopped or after using/shutdown
command.
If you need any further instructions on how to configure your bot or you had any difficulties doing so - please use wiki in this repository to get more detailed instructions.
CLI arguments
Of course bot also has them. You can perform some actions with them.
--create-user
- create new API user. Requires config key"posting.api.address"
to be set;--create-album
- create new API album. Requires API address and user config ("posting.api"
) to be complete.
Examples:
python main.py --create-user
python main.py --create-user --create-album
Tips and improvements
- You may want to configure your bot to work as a systemd service instead. There's a tutorial for that in the wiki.
Localization
Bot is capable of using custom locales. There are some that are pre-installed (English and Ukrainian), however you can add your own locales too.
All localization files are located in the locale
. Just copy locale file of your choice, name it in accordance to IETF language tags (if you want your locale to be compatible with Telegram's locales) or define your own name. Save it as json and you're good to go. If you want to change default locale for messages - edit "locale"
parameter in the config.json
.
We recommend to only make changes to your custom locale. Or at least always have your backup of for example en.json
as your fallback.