From 78fe0857e8913e226a0fb09c06feaa6b09c8b22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gro=C3=9F?= Date: Wed, 23 Nov 2022 17:34:01 +0100 Subject: [PATCH] CardUtils: Add helper to get one-line formatted card info --- util/cards.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/cards.js b/util/cards.js index ecaf68a..d060062 100644 --- a/util/cards.js +++ b/util/cards.js @@ -1,5 +1,6 @@ const { customAlphabet } = require("nanoid"); const { Card, Character } = require("../models"); +const { QUALITY_SYMBOLS } = require("../config/constants"); module.exports = { name: "CardUtils", @@ -19,5 +20,9 @@ module.exports = { getCharacterCount: async function(characterId) { return await Character.count(); + }, + + getShortString: function(card) { + return `[\`${card.identifier}\`] ${QUALITY_SYMBOLS[card.quality]} ${card.Character.name} (${card.printNr})`; } }