Bot that posts a random picture from a directory to Twitter and the Fediverse
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.
dtluna e013fb794e Enable releases for Gitea 2 months ago
constants Use Go modules 3 months ago
errors Add commentaries for exported functions and constants 1 year ago
mastodon Use Go modules 3 months ago
validation Use Go modules 3 months ago
.gitignore Use goreleaser 3 months ago
.goreleaser.yml Enable releases for Gitea 2 months ago
LICENSE Initial commit 1 year ago
README.md Use Go modules 3 months ago
go.mod Use Go modules 3 months ago
go.sum Use Go modules 3 months ago
main.go Use Go modules 3 months ago

README.md

random_picture_bot

Bot that posts a random picture from a directory to various social networks

Configuration

The location for config is:

  • Linux, Unix and Mac - $XDG_CONFIG_HOME/random_picture_bot/config.ini or ~/.config/random_picture_bot/config.ini if XDG_CONFIG_HOME is undefined
  • Windows - %APPDATA%\random_picture_bot\config.ini

The format of the file is INI and it has one main section and can have multiple secondary sections.

The main section has two settings:

  • pattern - required, a glob pattern specifying files to choose from
  • schedule - required, a cron expression specifying when to post the files

Secondary sections have two required settings:

  • url - required, specifies the URL to the social network
  • type - required, specifies the type of the social network; currently mastodon is the only choice, but it works with Pleroma as well

Sections with type = mastodon have three additional settings:

  • client_id - ID for the bot given by the social network after registering the app; usually is added automatically
  • client_secret - secret for the bot given by the social network after registering the app; usually is added automatically
  • access_token - a token to authenticate the requests from the bot; usually is added automatically

Example:

pattern = /home/dt/Pictures/memes/**/*  # selects all files in all subdirectories of /home/dt/Pictures/memes/
schedule = @hourly

[social.dtluna.net]
type = mastodon
url = https://social.dtluna.net
client_id = XXX
client_secret = XXX
access_token = XXX