koishi-plugin-beatsaber-bot
Version:
一个 用于 BeatSaber 的 koishi Bot 插件
24 lines (23 loc) • 733 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.aioRequest = void 0;
const aioRequest = (ctx, cfg) => {
const http = ctx.http;
let host = "https://aiobs.ktlab.io";
if (host.endsWith("/")) {
host = host.substring(0, host.length - 1);
}
const url = (path) => {
if (!path.startsWith("/")) {
path = "/" + path;
}
return host + path;
};
const getBSOAuthToken = async (key) => http.get(url(`/api/oauth/beatsaver/token/${key}`));
const getBLOAuthToken = async (key) => http.get(url(`/api/oauth/beatleader/token/${key}`));
return {
getBSOAuthToken,
getBLOAuthToken
};
};
exports.aioRequest = aioRequest;