Renovate
c38d79afe1
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.3.0` -> `~=10.4.0` | --- ### Release Notes <details> <summary>python-pillow/Pillow (pillow)</summary> ### [`v10.4.0`](https://github.com/python-pillow/Pillow/blob/HEAD/CHANGES.rst#1040-2024-07-01) [Compare Source](https://github.com/python-pillow/Pillow/compare/10.3.0...10.4.0) - Raise FileNotFoundError if show_file() path does not exist [#​8178](https://github.com/python-pillow/Pillow/issues/8178) \[radarhere] - Improved reading 16-bit TGA images with colour [#​7965](https://github.com/python-pillow/Pillow/issues/7965) \[Yay295, radarhere] - Deprecate non-image ImageCms modes [#​8031](https://github.com/python-pillow/Pillow/issues/8031) \[radarhere] - Fixed processing multiple JPEG EXIF markers [#​8127](https://github.com/python-pillow/Pillow/issues/8127) \[radarhere] - Do not preserve EXIFIFD tag by default when saving TIFF images [#​8110](https://github.com/python-pillow/Pillow/issues/8110) \[radarhere] - Added ImageFont.load_default_imagefont() [#​8086](https://github.com/python-pillow/Pillow/issues/8086) \[radarhere] - Added Image.WARN_POSSIBLE_FORMATS [#​8063](https://github.com/python-pillow/Pillow/issues/8063) \[radarhere] - Remove zero-byte end padding when parsing any XMP data [#​8171](https://github.com/python-pillow/Pillow/issues/8171) \[radarhere] - Do not detect Ultra HDR images as MPO [#​8056](https://github.com/python-pillow/Pillow/issues/8056) \[radarhere] - Raise SyntaxError specific to JP2 [#​8146](https://github.com/python-pillow/Pillow/issues/8146) \[Yay295, radarhere] - Do not use first frame duration for other frames when saving APNG images [#​8104](https://github.com/python-pillow/Pillow/issues/8104) \[radarhere] - Consider I;16 pixel size when using a 1 mode mask [#​8112](https://github.com/python-pillow/Pillow/issues/8112) \[radarhere] - When saving multiple PNG frames, convert to mode rather than raw mode [#​8087](https://github.com/python-pillow/Pillow/issues/8087) \[radarhere] - Added byte support to FreeTypeFont [#​8141](https://github.com/python-pillow/Pillow/issues/8141) \[radarhere] - Allow float center for rotate operations [#​8114](https://github.com/python-pillow/Pillow/issues/8114) \[radarhere] - Do not read layers immediately when opening PSD images [#​8039](https://github.com/python-pillow/Pillow/issues/8039) \[radarhere] - Restore original thread state [#​8065](https://github.com/python-pillow/Pillow/issues/8065) \[radarhere] - Read IM and TIFF images as RGB, rather than RGBX [#​7997](https://github.com/python-pillow/Pillow/issues/7997) \[radarhere] - Only preserve TIFF IPTC_NAA_CHUNK tag if type is BYTE or UNDEFINED [#​7948](https://github.com/python-pillow/Pillow/issues/7948) \[radarhere] - Clarify ImageDraw2 error message when size is missing [#​8165](https://github.com/python-pillow/Pillow/issues/8165) \[radarhere] - Support unpacking more rawmodes to RGBA palettes [#​7966](https://github.com/python-pillow/Pillow/issues/7966) \[radarhere] - Removed support for Qt 5 [#​8159](https://github.com/python-pillow/Pillow/issues/8159) \[radarhere] - Improve `ImageFont.freetype` support for XDG directories on Linux [#​8135](https://github.com/python-pillow/Pillow/issues/8135) \[mamg22, radarhere] - Improved consistency of XMP handling [#​8069](https://github.com/python-pillow/Pillow/issues/8069) \[radarhere] - Use pkg-config to help find libwebp and raqm [#​8142](https://github.com/python-pillow/Pillow/issues/8142) \[radarhere] - Accept 't' suffix for libtiff version [#​8126](https://github.com/python-pillow/Pillow/issues/8126), [#​8129](https://github.com/python-pillow/Pillow/issues/8129) \[radarhere] - Deprecate ImageDraw.getdraw hints parameter [#​8124](https://github.com/python-pillow/Pillow/issues/8124) \[radarhere, hugovk] - Added ImageDraw circle() [#​8085](https://github.com/python-pillow/Pillow/issues/8085) \[void4, hugovk, radarhere] - Add mypy target to Makefile [#​8077](https://github.com/python-pillow/Pillow/issues/8077) \[Yay295] - Added more modes to Image.MODES [#​7984](https://github.com/python-pillow/Pillow/issues/7984) \[radarhere] - Deprecate BGR;15, BGR;16 and BGR;24 modes [#​7978](https://github.com/python-pillow/Pillow/issues/7978) \[radarhere, hugovk] - Fix ImagingAccess for I;16N on big-endian [#​7921](https://github.com/python-pillow/Pillow/issues/7921) \[Yay295, radarhere] - Support reading P mode TIFF images with padding [#​7996](https://github.com/python-pillow/Pillow/issues/7996) \[radarhere] - Deprecate support for libtiff < 4 [#​7998](https://github.com/python-pillow/Pillow/issues/7998) \[radarhere, hugovk] - Corrected ImageShow UnixViewer command [#​7987](https://github.com/python-pillow/Pillow/issues/7987) \[radarhere] - Use functools.cached_property in ImageStat [#​7952](https://github.com/python-pillow/Pillow/issues/7952) \[nulano, hugovk, radarhere] - Add support for reading BITMAPV2INFOHEADER and BITMAPV3INFOHEADER [#​7956](https://github.com/python-pillow/Pillow/issues/7956) \[Cirras, radarhere] - Support reading CMYK JPEG2000 images [#​7947](https://github.com/python-pillow/Pillow/issues/7947) \[radarhere] </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: #82 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.