A fediverse bot for looking up links, Oracle text and images for Magic: The Gathering cards. See it in action at https://botsin.space/@MTGCardLookup
Go to file
Holly 925063e531 Fix API issues with automated following
- Don't try to follow accounts that have migrated away (This should be a softblock?)
- Wait a second between follows/unfollows so as to not so easily trip the rate limit
2024-12-16 00:30:15 +00:00
readme-assets Update readme with config instructions, move images around 2024-04-15 17:45:58 +00:00
.gitignore Gitignore touchups 2024-04-15 17:35:57 +00:00
LICENSE Initial commit 2021-03-09 03:01:43 +00:00
README.md Allow users to request a rescan of a message that was missed 2024-04-15 20:23:28 +00:00
config.sample.py Handles opting in/out and listens for statuses from opted in accounts 2021-03-08 23:32:26 -05:00
debug.py fix a stray import 2021-03-09 18:48:38 +00:00
easter_eggs.py Refactor easter eggs into a separate file 2021-12-17 20:44:58 +00:00
face.py Fix broken DFC support 2021-12-17 20:42:08 +00:00
mtgcardlookup.py Fix API issues with automated following 2024-12-16 00:30:15 +00:00
mtgcardlookup.service Flesh out readme 2022-01-31 14:18:19 -05:00
requirements.txt Put back a dependancy I removed because I thought it wasn't needed anymore 🤦‍♀️ 2024-04-15 20:36:23 +00:00

README.md

mtg-card-lookup

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. Finally, if you made a post that you intended to be scanned, but wasn't because you forgot to mention the bot, reply to that post while mentioning the bot and the text "last", "back", "parent" or "up".

See it in action here!

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

Installation and Setup

  • Clone this repository and create a python environment however you like to
  • Install dependencies with pip install -r requirements.txt
  • Obtain a client_key, client_secret and access_token for the API for the instance you'll be running the bot on. Copy config.sample.py to config.py and include those values. Set the instance as well, if it's not https://botsin.space.
  • 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.