Skip to content

Releases: Valgorithms/DiscordPHP-MTG

v1.1.0

Choose a tag to compare

@valzargaming valzargaming released this 03 Oct 21:44

The bot is rebuilt like Tutelar: slash and right-click commands, Components V2 messages, and today's card prices.

Commands

Command What it does
/card show <name> [set] A card: art, rules text, today's price and its set, with buttons for rulings, legality, prices, foreign names, the full image and JSON, Flip for double-faced cards, a printing picker, and links to Scryfall, EDHREC, TCGplayer, Card Kingdom and Cardmarket.
/card search … Cards by name, type, rules text, colors, color identity, mana value, rarity, set, format legality, keyword, artist, power and toughness, in pages; open one, then Back to results.
/card random [filters] A random card, with 🎲 Another.
/card prices <name> [set] Today's retail and buylist prices at TCGplayer, Card Kingdom, Cardmarket, Mana Pool and Cardhoarder.
/set show · /set search A set's size, dates and boosters, with Browse cards, Open a booster and Decks.
/booster <set> [type] Open a pack with the real product's odds, its value, Images and Open another.
/deck show · /deck search Preconstructed decks by card type, with Export decklist for MTG Arena and deck sites.
Find cards (right-click a message) Looks up every [[Card Name]] in it. Inline [[...]] replies are opt-in with MTG_INLINE_LOOKUPS=1 (needs the Message Content intent).
/help · /about · /invite · /ping Guide, data freshness, install links, latency.

/card_search still works as before. Names, sets, keywords and formats autocomplete; every command takes hidden:true.

How it works

  • Features are modules (MTG\Modules\*), booted once the gateway and the application are ready. Each declares its commands, and MTG::defineCommand() creates missing ones and re-registers changed ones, so command edits now reach Discord.
  • Buttons and pickers carry stable custom ids routed by one listener per module, so they keep working after a restart.
  • Messages are MessageBuilder subclasses in MTG\Builders, tested against Discord's limits on hundreds of real cards, sets, boosters and decks.

Prices

MTGJSON's daily price file takes about 1 GB to decode, so the new prices workflow turns it into a 12 MB SQLite file each day and publishes it on the prices release. The bot downloads that (~5 MB gzipped) and refreshes it daily; MTG_PRICES=0 turns it off. Cards carry prices, read with Card::getPrice().

Library additions

  • CardRepository::countCards(), getPrintings(); getCards(['unique' => true]) for one printing per card.
  • SetRepository::countSets(), countDecks(); set searches take year.
  • MTG::addModule(), defineCommand(), getPriceDatabase(), getSuggestions(), getSearchCache().

Fixed

  • DiscordPHP's bootstrap client could announce application-init before the MTG client had the application, so commands could be registered against an unbound application id.
  • Set filters that tell a code from a name now wait for the card build to open.

Deprecated

  • Card::toContainer() and the Card::get*Button() helpers; use MTG\Builders\CardMessageBuilder.

Removed

  • bot.php's HTTP listener on port 55555, which was never attached to its socket and never answered (http_port is gone from env.example).

Full Changelog: v1.0.0...v1.1.0

v1.0.0

Choose a tag to compare

@valzargaming valzargaming released this 03 Oct 19:35

DiscordPHP-MTG now gets its card data from MTGJSON instead of api.magicthegathering.io.

How the data is served

MTGJSON publishes whole files rather than a query API, so the client keeps a local copy of MTGJSON's AllPrintings SQLite build. On first start it streams AllPrintings.sqlite.gz (~250 MB) and inflates it to disk (~700 MB); after that it checks Meta.json daily and installs a new build only when MTGJSON has published one. Card, set and booster lookups run against that file. Decks, card types, keywords and build metadata come straight from the API.

Requires the pdo_sqlite and zlib extensions, and about 1.4 GB of free disk space.

New

  • Card search on every MTGJSON card field, keeping the old | (or) / , (and) syntax and the old parameter names (cmc, set, flavor, multiverseid, imageUrl, …) as aliases. Exact name matches and regular printings rank first.
  • Foreign-name search (language + name), format legality (gameFormat + legality), any identifier (scryfallId, mtgArenaId, …).
  • SetRepository::generateBooster() works again, opening packs from MTGJSON's booster configurations; getBoosterTypes() lists them.
  • DeckRepository ($mtg->decks): search the deck list, fetch a deck with its cards.
  • MTG::getKeywords(), getEnumValues(), getMeta(), getCardTypes().
  • Card images from Scryfall ($card->image_url); identifiers, purchase URLs and leadership skills as parts.
  • The bot answers a failed search instead of leaving /card_search thinking.

Fixed

  • DiscordPHP's bootstrap client part could reclaim the client after startup, intermittently turning $mtg->cards and $mtg->sets into null.

Breaking changes

  • Card fields use MTGJSON's names (manaValue, setCode, flavorText, uuid, …); ForeignName is now ForeignData; the CardAttributes trait is gone.
  • Sets are keyed by code.
  • getFormats() returns MTGJSON's format keys (commander, paupercommander, …).
  • The mtg_api_key option is gone; MTG takes an mtgjson option (database, refresh_interval, preload).
  • .env.example is now env.example; MTGJSON_DATABASE moves the build out of var/mtgjson/.

Full Changelog: v0.10.2...v1.0.0

Card prices (daily)

Card prices (daily) Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 03 Oct 21:36

Today's card prices for DiscordPHP-MTG, rebuilt daily from MTGJSON's AllPricesToday by the prices workflow. prices.sqlite.gz is the build the bot downloads; prices.json holds its MTGJSON date and version. Prices come from MTGJSON's partners (TCGplayer, Card Kingdom, Cardmarket, Mana Pool, Cardhoarder).

v0.10.2

Choose a tag to compare

@valzargaming valzargaming released this 07 Sep 09:53

Full Changelog: v0.10.1...v0.10.2

v0.10.1

Choose a tag to compare

@valzargaming valzargaming released this 07 Sep 09:47

Full Changelog: v0.10.0...v0.10.1

v0.10.0

Choose a tag to compare

@valzargaming valzargaming released this 07 Sep 09:47

Full Changelog: v0.9.2...v0.10.0

v0.9.2

Choose a tag to compare

@valzargaming valzargaming released this 31 Aug 00:41

Full Changelog: v0.9.1...v0.9.2

v0.9.1

Choose a tag to compare

@valzargaming valzargaming released this 07 Apr 10:17

Full Changelog: v0.9.0...v0.9.1

v0.9.0

Choose a tag to compare

@valzargaming valzargaming released this 20 Mar 15:36

Full Changelog: v0.8.7...v0.9.0

v0.8.7

Choose a tag to compare

@valzargaming valzargaming released this 26 Dec 14:51

Full Changelog: v0.8.6...v0.8.7