UNPKG

koishi-plugin-beatsaber-bot

Version:

一个 用于 BeatSaber 的 koishi Bot 插件

55 lines (54 loc) 1.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BindCmd = void 0; const bind_scoresaber_1 = require("./bind-scoresaber"); const bind_beatsaver_1 = require("./bind-beatsaver"); const bind_beatleader_1 = require("./bind-beatleader"); const types_1 = require("../../types"); function BindCmd(ctx, cfg, render, api, logger) { const bindCmd = ctx .command('bsbot.bind <scoresaberId:string>') .userFields(['id']) .alias('bbbind') .alias('bbbindbs', { options: { p: "bs" } }) .alias('bbbindbl', { options: { p: "bl" } }) .alias('bbbindss', { options: { p: "ss" } }) .option('p', '<platform:string>') .action(async ({ session, options }, input) => { if (!options.p) { options.p = 'ss'; } let platform = types_1.Platform.SS; switch (options.p) { case 'bs': platform = types_1.Platform.BS; break; case 'bl': platform = types_1.Platform.BL; break; case 'ss': break; default: session.sendQuote(`${options.p} 这还不是一个可以绑定的平台`); return; } switch (platform) { case types_1.Platform.SS: await (0, bind_scoresaber_1.handleScoreSaberBind)(ctx, api, { session, options }, input); break; case types_1.Platform.BS: await (0, bind_beatsaver_1.handleBeatSaverBind)(ctx, api, { session, options }, input); break; case types_1.Platform.BL: await (0, bind_beatleader_1.handleBeatLeaderBind)(ctx, api, { session, options }, input); break; default: throw Error("unreachable code line"); } }); return { key: "bind", cmd: bindCmd, }; } exports.BindCmd = BindCmd;