Skip to content

shello/fruitmachinebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fruit Machine Mastodon Bot

Source code for the very silly bot deployed at @fruitmachine@botsin.space.

This codebase includes the Mastodon client and "Fruit Machine" image generator for the aforementioned bot.

Artwork

As configured, the fruit machine symbols are set to use the fabulous Mutant Standard, an alternative emoji set with great principles, and a highly readable and all around lovely design language.

If you like what you see, please support their work through donations or get yourself good merch from them.

Check the official website for the license of the emoji.

Mastodon Client

The Mastodon client is built for the purpose of this bot, using Mastodon.py (PyPI).

Operation

Requirements

  • Python 3.6.

Configuration

The bot's behaviour can be configured through data/resources.json.

Usage

Local usage

First you need to populate the resources/emoji/ directory with a structure of images as generated by orxporter. Check the directory's README for more details.

Then to generate a Fruit Machine locally:

$ ./bin/fruitmachine -o <path_for_image>

The standard output will show a status and image description.

Posting to Mastodon

To post to Mastodon, you need to set up the client by one of the following ways:

  1. Set the FRUITMACHINE_CLIENT_ID, FRUITMACHINE_CLIENT_SECRET and FRUITMACHINE_ACCESS_TOKEN environment variables with the values given on the Settings > Development > Your application interface of your Mastodon instance;
  2. Create a file named .ENV in the root directory of the project, with the same variables as above in the format variable_name=value, one per line.
  3. Create two text files, data/client_cred.secret and data/user_cred.secret. The first file should have the "Client ID" in the first line, and the "Client Secret" in second line; the second file needs to have the "Access Token" in the first line.

Then just use:

$ ./bin/fruitmachine

and a fruit machine will be posted to the account. You can use the -D switch to print "debug" data, and the post's visibility will be set to direct, i.e., only the account posting will be able to see it.

License

The code is licensed under an ISC license. Check LICENSE for details.

Check Mutant Standard's homepage for the emoji's license.

The Fruit Machine graphics are licensed under a Creative Commons LicenseCreative Commons Attribution 4.0 International License.

About

Source code for a silly Mastodon bot:

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published