UNPKG

koishi-plugin-beatsaber-bot

Version:

一个 用于 BeatSaber 的 koishi Bot 插件

35 lines (34 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.beatleader = void 0; const beatleader = async (ctx, api, { session, options }, input) => { const beatLeaderSubScribe = await ctx.database.get('BSBotSubscribe', { type: 'beatleader', selfId: session.selfId, platform: session.platform, channelId: session.channelId, }); if (beatLeaderSubScribe.length > 0) { const sub = beatLeaderSubScribe[0]; if (sub.enable) { session.sendQuote(session.text('commands.bsbot.subscribe.beatleader.exist')); return; } let data = { ...sub, enable: true }; await ctx.database.upsert('BSBotSubscribe', [data]); session.sendQuote(session.text('commands.bsbot.subscribe.beatleader.success')); return; } const sub = { channelId: session.channelId, selfId: session.selfId, platform: session.platform, enable: true, uid: session.uid, type: 'beatleader', data: {} }; await ctx.database.upsert('BSBotSubscribe', [sub]); session.sendQuote(session.text('commands.bsbot.subscribe.beatleader.success')); }; exports.beatleader = beatleader;