Un bot qui récupère une image random en local et la publie
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Luc Didry 97b2c6b01e
Lintings changes
4 weeks ago
limiter add limiter #7 5 months ago
secrets Mettre à jour 'secrets/secrets.txt' 7 months ago
utils finish streaming 6 months ago
.gitignore add distant image #3 5 months ago
LICENSE Initial commit 9 months ago
README.md improve doc 5 months ago
activity.log refactor code 7 months ago
blacklist.sample.json make blacklist #8 5 months ago
bot.py Lintings changes 4 weeks ago
collection.sample.json add distant image #3 5 months ago
config.sample.txt add distant image #3 5 months ago
rename_all_file.sh add renamer 4 months ago
requirements.txt add distant image #3 5 months ago



Un bot qui récupère une image random en local et la publie

Copiez le fichier config.sample.txt en config.txt, ajoutez le chemin de votre dossier image. Remplissez le fichier secrets/secrets.txt et remplissez le avec les code que vous trouverez dans l’onglet développeur de votre compte Mastodon.

Configure it

Copy config.sample.txt to config.txt and replace data by your data.

If you don’t want any “spoiler text”, just leave the line empty.

Field name Description Value
img_path Path where image are located /home/bot/img
name Name of your bot (name after @). Is usefull to hide it’s name in reply mybot
secrets_filepath Path where located secret secrets/secrets.txt
log_filepath Path where located log file activity.log
blacklist_filepath Path where located blacklist file blacklist.json
collection_filepath Path where located distant image collection collection.json
sensitive Hide picture behind “sensitive content” mask or not yes
default_text Text for --img option string
spoiler_text Text for every spoiler (or CW) (for --img or --stream option) string
limit Limit send per minute per person int
limit_hour Limit send par hour per person int
collection_url URL of website you deserve image. <collection> is a variable who depend on collection.json (you can remove this variable) string

Copy blacklist.sample.json to blacklist.json and replace or add accounts that should not receive any image

Copy collection.sample.json to collection.json and add collection for your bot

Use it

usage: bot.py [-h] [-i] [-s SOURCE] [--stream]

Choose between image or streaming

optional arguments:
  -h, --help            show this help message and exit
  -i, --img             post image
  -s SOURCE, --source SOURCE
                        Source of image [ local | distant ]
  --stream              stream user profile

--img option send image. --stream option send image on mention

Create a systemd service

On /etc/systemd/system/bot.service copy paste code behind

Description=Image bot Mastodon

ExecStart=/usr/bin/python3 bot.py --stream --source=local