data | ||
locale | ||
modules | ||
.gitignore | ||
config.json | ||
LICENSE | ||
loop.bat | ||
loop.sh | ||
main.py | ||
README_uk.md | ||
README.md | ||
requirements-optional.txt | ||
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 ;)
Шукаєш інструкцію українською? А вона ось тут знаходиться)
Installation
To make this bot run at first you need to have a Python interpreter and git. Google is your friend finding it. 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-standart executable path - you should also change it in scripts you will use (loop.sh
,loop.bat
,start.sh
andstart.bat
).
-
Download the bot:
git clone https://git.end-play.xyz/profitroll/TelegramSender.git
(if you want to use git)cd ./TelegramSender
-
Install dependencies:
python -m pip install -r requirements.txt
Without installing those - bot cannot work at all -
Install optional dependencies [Not required]:
python -m pip install -r requirements-optional.txt
These are not required but can make the bot run a bit faster -
Configure your bot with a favorite text editor:
nano config.json
You can edit with vim, nano, on Windows it's Notepad or Notepad++. Whatever.
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. -
Add bot to the channel:
To use your bot of course you need to have a channel or group otherwise makes no sense to have such a bot. Here you can find a quick guide how to add your bot to a channel. -
Fill your contents folder:
Of course bot cannot post something from nothing. Configure yourconfig.json
what media types bot should post ("posting", "extensions"
), when to post them ("posting", "time"
) and also where to find them ("locations"
). You can also move them when sent by setting"posting", "move_sent"
totrue
. -
Good to go, run it!
python ./main.py
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/reboot
command.
Command line arguments
Of course bot also has them. You can perform some actions with them.
--move-sent
- allows you to move all sent files from queue to sent directories--cleanup
- purge files in bothqueue
andsent
folders if they're sent. Requires--confirm
argument--cleanup-index
- purge all sent entries from index. Requires--confirm
argument--norun
- allows you to execute above arguments without triggering the bot start itself
Examples:
python3 ./main.py --move-sent --norun
python3 ./main.py --cleanup --confirm