UNPKG

nekos-js

Version:
33 lines (32 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.spoiler = exports.why = exports.owoify = exports.randomName = exports.image = exports.fact = exports.cat = exports.eightBall = void 0; const tslib_1 = require("tslib"); const axios_1 = tslib_1.__importDefault(require("axios")); const Endpoints_1 = require("../Endpoints"); const baseUrl = 'https://nekos.life/api/v2/'; const eightBall = async () => (await axios_1.default.get(`${baseUrl}/${Endpoints_1.Endpoints.EightBall}`)).data; exports.eightBall = eightBall; const cat = async () => (await axios_1.default.get(`${baseUrl}/${Endpoints_1.Endpoints.Cat}`)).data.cat; exports.cat = cat; const fact = async () => (await axios_1.default.get(`${baseUrl}/${Endpoints_1.Endpoints.Fact}`)).data.fact; exports.fact = fact; const image = async (categoty) => (await axios_1.default.get(`${baseUrl}/${Endpoints_1.Endpoints.Image}/${categoty}`)).data.url; exports.image = image; const randomName = async () => (await axios_1.default.get(`${baseUrl}/${Endpoints_1.Endpoints.Name}`)).data.name; exports.randomName = randomName; /** * @param text Max length is 200 **/ const owoify = async (text) => (await axios_1.default.get(`${baseUrl}/${Endpoints_1.Endpoints.Owoify}`, { params: { text, }, })).data.owo; exports.owoify = owoify; const why = async () => (await axios_1.default.get(`${baseUrl}/${Endpoints_1.Endpoints.Why}`)).data.why; exports.why = why; const spoiler = (text) => Array.from(text) .map((word) => `||${word}||`) .join(''); exports.spoiler = spoiler;