fix format.char()
This commit is contained in:
parent
ed9e7209d0
commit
347d1423fc
1 changed files with 4 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Character, ClassKey, CharacterClass, Nation } from "@src/types";
|
||||
import { Character, CharacterClass, Nation } from "@src/types";
|
||||
import { Emoji } from "@systems/emojis";
|
||||
import { WRankEntry } from "@systems/wrank";
|
||||
|
||||
|
|
@ -18,13 +18,11 @@ function charButton(c: Character, options?: { shared?: boolean }): string {
|
|||
* Format a character for display in embeds and messages.
|
||||
* Output: <:class:> 79 «Flash»
|
||||
*/
|
||||
function char(
|
||||
c: { class: ClassKey|CharacterClass; level: number; name: string },
|
||||
options?: CharDisplayOptions
|
||||
): string {
|
||||
function char(c: Character, options?: CharDisplayOptions): string {
|
||||
const showEmoji = options?.emoji ?? true;
|
||||
const showLevel = options?.level ?? true;
|
||||
const classStr = showEmoji ? (Emoji.class(c.class) || c.class) : c.class;
|
||||
const classKey = c.class.key;
|
||||
const classStr = showEmoji ? (Emoji.class(classKey) || classKey) : classKey;
|
||||
const levelStr = showLevel ? `${c.level} ` : "";
|
||||
return `${classStr} ${levelStr}${c.name}`.trim();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue