@azurapi/azurapi
Version:
Open Source Azur Lane Local Database
32 lines • 1.09 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Voicelines = void 0;
const api_1 = __importDefault(require("./api"));
/**
* Special voicelines class for extended functionality
*/
class Voicelines extends api_1.default {
/**
* Constructor
* @param client An AzurAPI instance
*/
constructor(client) {
super(client);
}
get(shipNameOrId) {
if (this.client.queryIsShipName(shipNameOrId)) {
const id = this.client.getShipIdByName(shipNameOrId);
return this.raw.filter((vl) => vl.id === id)[0];
}
const vlsForId = this.raw.filter((vl) => vl.id === shipNameOrId);
if (vlsForId.length === 0) {
throw new Error("Must use ship name or ID to get voice lines.");
}
return vlsForId[0];
}
}
exports.Voicelines = Voicelines;
//# sourceMappingURL=api_voiceline.js.map