GithubHelp home page GithubHelp logo

inventorbot's Introduction

Installation | Usage | Configuration | Example | Contributing

Inventor Bot

Github Crates.io OQL License

A fedi bot for posts in the format of 'I can't believe __ invented __'.

Inventor Bot can be installed from crates.io or manually installed from GitHub.

Crates.io

Assuming you already have the rust toolchain installed, you can simply install Inventor Bot by running

cargo install inventor_bot

Nix

You can also build Inventor Bot using Nix flakes;

nix build github:KaitlynEthylia/InventorBot

Running the command inventor_bot will start the bot, but it will be unable to run until you provide it with a configuration file. A few command line arguments are provided to modify how the bot runs:

-c, --config <FILE>: Override the default config file path.

--cache <DIR>: Override the default cache directory path, ignoring any value set in the config. <br/ >

-l, --log <LEVEL>: Set the minimum level of logs to print. Valid values are 'debug', 'info', 'warn', 'error', and 'off'.

-t, --token <TOKEN>: The authorisation token for the bot to use. This will override whatever is in the cache unless --no-cache is also passed. The token must have write:statuses permissions.

-n, --no-cache: Disables caching, meaning that no authorisation tokens will be stored. Useful if passing a token via the --token argument, and you don't want it to override the currently stored token.

By default, Inventor Bot will look for configuration in the following places:

Platform Location
Linux $XDG_CONFIG_HOME/inventor_bot.toml
Windows %APPDATA%\inventor_bot.toml
MacOS $HOME/Library/Application Suport/inventor_bot.toml

The config is relatively small, with only a few important options:

Option Type Description
inventors List of strings Possible people to fill in the first blank in "I can't believe ___ invented ___".
instance String The Fedi instance to post to
repeat Null or Integer The delay between repeated postings in minutes. Null (i.e. Omitting the option) means that the bot will make a post and then the application will exit.
visibility "public" or "unlisted" The visibility of the posts made to fedi.

Caching

To prevent you from having to log in every time you start the bot, It's possible to cache the authorisation token you generate when logging in. The following options are available for caching:

Option Type Description
cache.enable Boolean Whether to enable caching, off by default.
cache.path String The path to store the cache at. This should be a directory. The default value on linux is $XDG_CACHE_HOME/inventor_bot/
cache.protect Boolean Whether to encrypt the cache with a password. If caching is enabled and this is not, a warning will be printed whenever you start the bot.

Advanced Options

These options are not particularly useful to most people, but exist anyways:

Option Type Description
dry_run Boolean When enabled, the bot will never actually post, and print to the terminal instead. This exists mostly to help with debugging.
port Integer The port to listen on whilst waiting for authorisation
lang String The language to request the authorisation page be displayed in. Currently this has no effect on the output of the bot. If I can be bothered, I might change this.
client String The name of the client to register the bot under to the fedi instance

An example config may look something like this:

instance = "tech.lgbt"
repeat = 360

inventors = [
	"Hatsune Miku",
	"Hatsune Miku",
	"Hatsune Miku",
	"Yassie",
	"Yassie",
	"Kasane Teto",
	"Inventor Bot",
	"your mum",
	"Luna",
	"jerma985",
	"the media",
]

[cache]
enable = true
protect = true

Like.. just open a PR or something, idk...

inventorbot's People

Contributors

kaitlynethylia avatar

Stargazers

Luna avatar Isabel avatar uncenter avatar

Watchers

Lucian avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.