UNPKG

koishi-plugin-beatsaber-bot

Version:

一个 用于 BeatSaber 的 koishi Bot 插件

28 lines (27 loc) 830 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.scRequest = void 0; const scRequest = (ctx, cfg) => { const http = ctx.http; let host = "https://scoresaber.com"; if (host.endsWith("/")) { host = host.substring(0, host.length - 1); } const url = (path) => { if (!path.startsWith("/")) { path = "/" + path; } return host + path; }; const getScoreUserById = async (userId) => { return http.get(url(`/api/player/${userId}/full`)); }; const getScoreItemsById = (userId, page, pageSize = 8) => { return http.get(url(`/api/player/${userId}/scores?page=${page}&sort=top&limit=${pageSize}`)); }; return { getScoreUserById, getScoreItemsById }; }; exports.scRequest = scRequest;