diff --git a/README.md b/README.md index 1352953..16ff042 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ # mtg-card-lookup -A fediverse bot to look up Magic: The Gathering cards \ No newline at end of file +A fediverse bot to look up Magic: The Gathering cards. + +To use, mention the bot with a message that contains at least one Magic card name wrapped in either [[square brackets]] or {{curly braces}}. It will search Scryfall for the card and reply with the result. Alternatively, follow the bot, and it will follow you back. Any posts it sees with that syntax in its home timeline will also be processed. + +See it in action [here](https://botsin.space/@mtgcardlookup)! + +![](example-lotus.png) + +## Features + +- Automatically keeps its follower and following lists synced + - Follows back accounts instantly, unfollows every 5 minutes (API restriction) +- If four or less cards are requested, includes images of each card with Oracle text in the description + - Double Faced Card images are handled by combining both faces into a single image +- Uses fuzzy searching to correct shortenings where possible +- Replies at the same privacy level as it was called with, or unlisted, whichever is more restrictive +- Includes pinned status management (see "Installation and Setup") + - Unpins all current statuses, then posts a pre-written thread and pins each new status in reverse order + +![](example-garruk.png) + +## Installation and Setup + +- Clone this repository and create a python environment however you like to +- Install dependencies with `pip install -r requirements.txt` +- Install and enable the included mtgcardlookup.service with systemd, replacing the `ExecStart`, `WorkingDirectory`, and `User` values with those for your system +- [OPTIONAL] Write an introduction thread to be pinned + - Create a new file called pinned_thread.txt + - Write each status of the introduction thread, separated by `\n-----\n` + - Run `./mtgcardlookup --update-pins`. The thread will be posted and pinned + - In the future, you can modify pinned_thread.txt and rerun the command. The existing thread will be unpinned and the modified one will be posted and pinned. \ No newline at end of file diff --git a/example-garruk.png b/example-garruk.png new file mode 100644 index 0000000..6fa6b10 Binary files /dev/null and b/example-garruk.png differ diff --git a/example-lotus.png b/example-lotus.png new file mode 100644 index 0000000..c697ae6 Binary files /dev/null and b/example-lotus.png differ diff --git a/mtgcardlookup.service b/mtgcardlookup.service new file mode 100644 index 0000000..8ad329c --- /dev/null +++ b/mtgcardlookup.service @@ -0,0 +1,17 @@ +[Unit] +Description=MTG Card Lookup Service +After=multi-user.target + +StartLimitIntervalSec=0 + +[Service] +Type=idle +Restart=on-failure +RestartSec=5s +ExecStart=/PATH/TO/LOCAL/REPO/mtgcardlookup.py +WorkingDirectory=/PATH/TO/LOCAL/REPO/mtg-card-lookup/ +User=YOUR_USERNAME +Environment=PYTHONUNBUFFERED=1 + +[Install] +WantedBy=multi-user.target