A simple Telegram bot which mainly provides inline mode, fetching illustrations from Pixiv
You can view my instance of it at @InlinePixivBot
- download
example-config.iniinto a memorable location (perhaps~/.config/inline-pixiv-bot?) and edit it as per the installation section. - Fire up docker! It will use the config file from the previous step.
docker run -d --name inline-pixiv-bot \
-v ~/.config/inline-pixiv-bot/config.ini:/usr/src/app/config.ini \
-v ~/.config/inline-pixiv-bot/bot.session:/usr/src/app/bot.session \
kyle2142/inline-pixiv-bot:latestThe second -v line is optional and is only for re-using a session file (it must exist).
Note that if you are running this on a PC/laptop, you will likely need to configure file sharing for the config file.
As a docker-only feature, docker logs inline-pixiv-bot works.
- Python 3.5 or higher
The following can be automatically installed using requirements.txt (refer to next section)
These steps are intended for unix-like systems but are easily translated for others
git clone https://github.com/Kyle2142/inline-pixiv-botcd inline-pixiv-bot- Optional: set up a virtualenv
virtualenv -p /usr/bin/python3 .source ./bin/activate
pip3 install -r requirements.txt- Copy and edit config.
cp example-config.ini config.ininano config.ini(use your preferred editor)
Simply python3 inlinepixivbot.py
You can use a program like tmux or screen to keep this as a background service.
Alternatively, here is a sample systemd service file:
[Unit]
Description=Inline telegram bot for pixiv
After=network.target
[Service]
WorkingDirectory=/path/to/inlinepixivbot/folder
#note that the below assumes you have a venv as per step 3 above
ExecStart=/path/to/inlinepixivbot/folder/bin/python inlinepixivbot.py
TimeoutStopSec=10
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
You can install this by
sudo systemctl edit --force -l inlinepixivbot
sudo systemctl enable inlinepixivbot # if you want the bot started on reboot
sudo systemctl start inlinepixivbotLogs are stored in logs/bot.log and will automatically rotate up to a maximum of 5 5MB files