|
|
@ -22,8 +22,6 @@ import { readFile } from 'fs/promises'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { default as Sharp } from 'sharp'; |
|
|
|
import { default as Sharp } from 'sharp'; |
|
|
|
|
|
|
|
|
|
|
|
const dataDir = '../data'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const CharacterOptionTemplate = { |
|
|
|
export const CharacterOptionTemplate = { |
|
|
|
name: 'character', |
|
|
|
name: 'character', |
|
|
|
description: 'The character(s) to operate on.', |
|
|
|
description: 'The character(s) to operate on.', |
|
|
@ -212,7 +210,7 @@ export abstract class AbstractCharacterStatusCommand extends SlashCommand { |
|
|
|
async loadCharacters(names: Iterable<string>): Promise<GameCharacterData[]> { |
|
|
|
async loadCharacters(names: Iterable<string>): Promise<GameCharacterData[]> { |
|
|
|
return Promise.all( |
|
|
|
return Promise.all( |
|
|
|
Array.from(names).map((name) => |
|
|
|
Array.from(names).map((name) => |
|
|
|
loadCharacter(dataDir, name) |
|
|
|
loadCharacter(this.dataDir, name) |
|
|
|
.then<LoadedCharacterData>((c) => ({ name, success: true, originalData: c })) |
|
|
|
.then<LoadedCharacterData>((c) => ({ name, success: true, originalData: c })) |
|
|
|
.catch<ErrorCharacterData>((e) => ({ name, success: false, error: e })) |
|
|
|
.catch<ErrorCharacterData>((e) => ({ name, success: false, error: e })) |
|
|
|
) |
|
|
|
) |
|
|
|