Skip to content

Commit

Permalink
Update OCG+TCG card embed illustration to Master Duel art from Yugipedia
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlul committed Mar 2, 2024
1 parent 0461544 commit 253f88f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ export function ygoprodeckCard(term: string | number): string {
return `https://ygoprodeck.com/card/?search=${encodeURIComponent(term)}&utm_source=bastion`;
}

function masterDuelIllustrationURL(card: Static<typeof CardSchema>): string {
// Filter card name down to alphanumeric characters
const probableBasename = (card.name.en ?? "").replaceAll(/\W/g, "");
return `https://yugipedia.com/wiki/Special:Redirect/file/${probableBasename}-MADU-EN-VG-artwork.png`;
}

export function createCardEmbed(
card: Static<typeof CardSchema>,
lang: Locale,
Expand All @@ -381,7 +387,7 @@ export function createCardEmbed(
const embed = new EmbedBuilder()
.setTitle(formatCardName(card, lang))
.setURL(ygoprodeck)
.setThumbnail(`${process.env.IMAGE_HOST}/${card.password}.png`);
.setThumbnail(masterDuelIllustrationURL(card));

const links = {
name: t`🔗 Links`,
Expand Down

0 comments on commit 253f88f

Please sign in to comment.