UNPKG

koishi-plugin-bilibili-notify-advanced-subscription

Version:
86 lines (83 loc) 6.55 kB
//#region rolldown:runtime var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); //#endregion const koishi = __toESM(require("koishi")); require("koishi-plugin-bilibili-notify"); //#region src/index.ts const name = "bilibili-notify-advanced-subscription"; const Config = koishi.Schema.object({ subs: koishi.Schema.dict(koishi.Schema.object({ uid: koishi.Schema.string().required().description("订阅用户UID"), roomid: koishi.Schema.string().description("订阅用户直播间号,不填则会请求用户接口自动获取,但请求该接口容易风控"), dynamic: koishi.Schema.boolean().default(false).description("是否订阅用户动态"), live: koishi.Schema.boolean().default(false).description("是否订阅用户直播"), target: koishi.Schema.array(koishi.Schema.object({ platform: koishi.Schema.string().required().description("推送平台,例如onebot、qq、discord"), channelArr: koishi.Schema.array(koishi.Schema.object({ channelId: koishi.Schema.string().required().description("频道/群组号"), dynamic: koishi.Schema.boolean().default(true).description("动态通知"), dynamicAtAll: koishi.Schema.boolean().default(false).description("动态艾特全体"), live: koishi.Schema.boolean().default(true).description("直播通知"), liveAtAll: koishi.Schema.boolean().default(true).description("开播艾特全体"), liveGuardBuy: koishi.Schema.boolean().default(false).description("上舰通知"), wordcloud: koishi.Schema.boolean().default(true).description("弹幕词云通知"), liveSummary: koishi.Schema.boolean().default(true).description("直播总结通知") })).role("table").required().description("需推送的频道/群组详细设置") })).description("订阅用户需要发送的平台和频道/群组信息(一个平台下可以推送多个频道/群组)"), customLiveSummary: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启个性化直播总结") }), koishi.Schema.union([koishi.Schema.object({ enable: koishi.Schema.const(true).required(), liveSummary: koishi.Schema.array(String).default([ "🔍【弹幕情报站】本场直播数据如下:", "🧍‍♂️ 总共 -dmc 位-mdn上线", "💬 共计 -dca 条弹幕飞驰而过", "📊 热词云图已生成,快来看看你有没有上榜!", "👑 本场顶级输出选手:", "🥇 -un1 - 弹幕输出 -dc1 条", "🥈 -un2 - 弹幕 -dc2 条,萌力惊人", "🥉 -un3 - -dc3 条精准狙击", "🎖️ 特别嘉奖:-un4 & -un5", "你们的弹幕,我们都记录在案!🕵️‍♀️" ]).role("table").description("自定义直播总结语,开启弹幕词云自动发送。变量解释:-dmc代表总弹幕发送人数,-mdn代表主播粉丝牌子名,-dca代表总弹幕数,-un1到-un5代表弹幕发送条数前五名用户的用户名,-dc1到-dc5代表弹幕发送条数前五名的弹幕发送数量,数组每一行代表换行") }), koishi.Schema.object({})])]), customLiveMsg: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启个性化直播消息设置") }), koishi.Schema.union([koishi.Schema.object({ enable: koishi.Schema.const(true).required(), customLiveStart: koishi.Schema.string().description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"), customLive: koishi.Schema.string().description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计观看人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name正在直播,会发送为xxxUP正在直播xxx"), customLiveEnd: koishi.Schema.string().description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长,\\n为换行。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒") }), koishi.Schema.object({})])]), customCardStyle: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启自定义卡片颜色") }), koishi.Schema.union([koishi.Schema.object({ enable: koishi.Schema.const(true).required(), cardColorStart: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"), cardColorEnd: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"), cardBasePlateColor: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).description("推送卡片底板颜色,请填入16进制颜色代码"), cardBasePlateBorder: koishi.Schema.string().pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/).description("推送卡片底板边框宽度,请填入css单位,例如1px,12.5rem,100%") }), koishi.Schema.object({})])]) }).collapse()) }); function apply(ctx, config) { ctx.emit("bilibili-notify/advanced-sub", config.subs); ctx.on("bilibili-notify/ready-to-recive", () => { ctx.emit("bilibili-notify/advanced-sub", config.subs); }); } //#endregion exports.Config = Config; exports.apply = apply; exports.name = name;