koishi-plugin-bilibili-notify 3.6.0-alpha.3 → 3.6.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +352 -344
- package/lib/index.d.cts +12 -12
- package/lib/index.d.mts +12 -12
- package/lib/index.mjs +352 -344
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -69,38 +69,13 @@ openai = __toESM(openai);
|
|
|
69
69
|
|
|
70
70
|
//#region src/config.ts
|
|
71
71
|
const BAConfigSchema = koishi.Schema.object({
|
|
72
|
-
require: koishi.Schema.object({}).description("
|
|
73
|
-
key: koishi.Schema.string().pattern(/^[0-9a-f]{32}$/).role("secret").required().description("
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
platform: koishi.Schema.union([
|
|
77
|
-
"qq",
|
|
78
|
-
"qqguild",
|
|
79
|
-
"onebot",
|
|
80
|
-
"discord",
|
|
81
|
-
"red",
|
|
82
|
-
"telegram",
|
|
83
|
-
"satori",
|
|
84
|
-
"chronocat",
|
|
85
|
-
"lark"
|
|
86
|
-
]).description("请选择您的私人机器人平台"),
|
|
87
|
-
masterAccount: koishi.Schema.string().role("secret").required().description("主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID"),
|
|
88
|
-
masterAccountGuildId: koishi.Schema.string().role("secret").description("主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID")
|
|
89
|
-
}), koishi.Schema.object({})])]),
|
|
90
|
-
basicSettings: koishi.Schema.object({}).description("基本设置"),
|
|
91
|
-
userAgent: koishi.Schema.string().description("设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111"),
|
|
92
|
-
ai: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启AI功能") }), koishi.Schema.union([koishi.Schema.object({
|
|
93
|
-
enable: koishi.Schema.const(true).required(),
|
|
94
|
-
apiKey: koishi.Schema.string().role("secret").required().description("API KEY"),
|
|
95
|
-
baseURL: koishi.Schema.string().required().description("API 访问地址"),
|
|
96
|
-
model: koishi.Schema.string().default("gpt-3.5-turbo").description("AI模型"),
|
|
97
|
-
persona: koishi.Schema.string().description("AI系统角色设定").default("你是一个风趣幽默的主播助理,你的任务是根据提供的直播数据生成一段有趣且富有创意的直播总结。请确保你的回答简洁明了,避免使用过于复杂的语言或长句子。请注意,你的回答必须与提供的数据相关,并且不能包含任何虚构的信息。如果你无法根据提供的数据生成总结,请礼貌地说明你无法完成任务。")
|
|
98
|
-
}), koishi.Schema.object({ enable: koishi.Schema.const(false) })])]),
|
|
99
|
-
subTitle: koishi.Schema.object({}).description("订阅配置"),
|
|
100
|
-
advancedSub: koishi.Schema.boolean().default(false).description("是否开启高级订阅,高级订阅是独立于本插件的一个专门用于订阅配置的插件,用于高度自定义订阅消息。若开启高级订阅,请打开该选项并下载插件 bilibili-notify-advanced-subscription"),
|
|
72
|
+
require: koishi.Schema.object({}).description("这里是主人的必填设置哟(;>_<)女仆会乖乖等主人填好再继续的~"),
|
|
73
|
+
key: koishi.Schema.string().pattern(/^[0-9a-f]{32}$/).role("secret").required().description("请主人输入一个 32 位的小写十六进制密钥喔 ( >﹏< )这个密钥会用来把主人的 B 站登录信息安全保存到数据库里~请一定一定要好好保管,不然忘掉了就要重新登录了啦 (;´д`)ゞ主人也可以去这个网站生成密钥:https://www.sexauth.com/"),
|
|
74
|
+
subTitle: koishi.Schema.object({}).description("订阅相关的配置都在这里~主人要订阅什么,女仆都负责帮您记好 (。>﹏<。)!"),
|
|
75
|
+
advancedSub: koishi.Schema.boolean().default(false).description("这个开关决定是否使用高级订阅功能喔~如果主人想要超级灵活的订阅内容,就请开启并安装 bilibili-notify-advanced-subscription 呀 (๑•̀ㅂ•́)و♡"),
|
|
101
76
|
subs: koishi.Schema.array(koishi.Schema.object({
|
|
102
77
|
name: koishi.Schema.string().required().description("UP昵称"),
|
|
103
|
-
uid: koishi.Schema.string().required().description("UID
|
|
78
|
+
uid: koishi.Schema.string().required().description("UID & roomid"),
|
|
104
79
|
dynamic: koishi.Schema.boolean().default(true).description("动态"),
|
|
105
80
|
dynamicAtAll: koishi.Schema.boolean().default(false).description("动态@全体"),
|
|
106
81
|
live: koishi.Schema.boolean().default(true).description("直播"),
|
|
@@ -111,14 +86,39 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
111
86
|
liveSummary: koishi.Schema.boolean().default(true).description("直播总结"),
|
|
112
87
|
platform: koishi.Schema.string().required().description("平台名"),
|
|
113
88
|
target: koishi.Schema.string().required().description("群号/频道号")
|
|
114
|
-
})).role("table").description("
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
89
|
+
})).role("table").description("在这里填写主人的订阅信息~UP 昵称、UID、roomid、平台、群号都要填正确,不然女仆会迷路哒 (;>_<)如果多个群聊/频道,请用英文逗号分隔哦~女仆会努力送到每一个地方的!"),
|
|
90
|
+
basicSettings: koishi.Schema.object({}).description("这是主人最基本的设置区域哒~女仆会乖乖等主人安排 (*´∀`)~♡"),
|
|
91
|
+
userAgent: koishi.Schema.string().description("这里可以设置请求头的 User-Agent 哦~如果请求出现了 -352 的奇怪错误,主人可以试着在这里换一个看看 (;>_<)UA 获取方法可以参考说明里的链接喔~ https://blog.csdn.net/qq_44503987/article/details/104929111"),
|
|
92
|
+
ai: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("要不要让女仆打开 AI 小脑袋呢?(〃ノωノ) 开了之后就能帮主人做更多事情啦!") }), koishi.Schema.union([koishi.Schema.object({
|
|
93
|
+
enable: koishi.Schema.const(true).required(),
|
|
94
|
+
apiKey: koishi.Schema.string().role("secret").required().description("请主人把 API Key 告诉女仆……会乖乖保护好的 (つ﹏⊂)♡"),
|
|
95
|
+
baseURL: koishi.Schema.string().required().description("AI 的访问地址在这里填哦~女仆会按照主人的指令去联络 AI 的 (*>ω<)b"),
|
|
96
|
+
model: koishi.Schema.string().default("gpt-3.5-turbo").description("请选择主人想用的 AI 模型~女仆会按主人的喜欢来工作的(〃´-`〃)♡"),
|
|
97
|
+
persona: koishi.Schema.string().description("这是 AI 的性格设定哟~主人可以随意决定它是什么样的角色,女仆会认真帮忙传达的 (*´艸`)").default("你是一个风趣幽默的主播助理,你的任务是根据提供的直播数据生成一段有趣且富有创意的直播总结。请确保你的回答简洁明了,避免使用过于复杂的语言或长句子。请注意,你的回答必须与提供的数据相关,并且不能包含任何虚构的信息。如果你无法根据提供的数据生成总结,请礼貌地说明你无法完成任务。")
|
|
98
|
+
}), koishi.Schema.object({ enable: koishi.Schema.const(false) })])]),
|
|
99
|
+
master: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("要不要让笨笨女仆开启主人账号功能呢?(>﹏<)如果机器人遭遇了奇怪的小错误,女仆会立刻跑来向主人报告的!不、不过……如果没有私聊权限的话,女仆就联系不到主人了……请不要打开这个开关喔 (;´д`)ゞ") }).description("主人的特别区域……女仆会乖乖侍奉的!(>///<)"), koishi.Schema.union([koishi.Schema.object({
|
|
100
|
+
enable: koishi.Schema.const(true).required(),
|
|
101
|
+
platform: koishi.Schema.union([
|
|
102
|
+
"qq",
|
|
103
|
+
"qqguild",
|
|
104
|
+
"onebot",
|
|
105
|
+
"discord",
|
|
106
|
+
"red",
|
|
107
|
+
"telegram",
|
|
108
|
+
"satori",
|
|
109
|
+
"chronocat",
|
|
110
|
+
"lark"
|
|
111
|
+
]).description("主人想让女仆在哪个平台伺候您呢?请从这里选一个吧~(〃´-`〃)♡女仆会乖乖待在主人选的地方哒!"),
|
|
112
|
+
masterAccount: koishi.Schema.string().role("secret").required().description("请主人把自己的账号告诉女仆嘛……不然女仆会找不到主人哒 (つ﹏⊂)在 Q 群的话用 QQ 号就可以了~其他平台请用 inspect 插件告诉女仆主人的 ID 哦 (´。• ᵕ •。`) ♡"),
|
|
113
|
+
masterAccountGuildId: koishi.Schema.string().role("secret").description("如果是在 QQ 频道、Discord 这种地方……主人的群组 ID 也要告诉女仆喔 (;>_<)不然女仆会迷路找不到主人……请用 inspect 插件带女仆去看看嘛~(〃ノωノ)")
|
|
114
|
+
}), koishi.Schema.object({})])]),
|
|
115
|
+
dynamic: koishi.Schema.object({}).description("动态推送的相关设置都在这里,让女仆乖乖监测 UP 动态 (*´∀`)~♡"),
|
|
116
|
+
dynamicUrl: koishi.Schema.boolean().default(false).description("发送动态时要不要顺便发链接呢?但如果主人用的是 QQ 官方机器人,这个开关不要开喔~不然会出事的 (;>_<)!"),
|
|
117
|
+
dynamicCron: koishi.Schema.string().default("*/2 * * * *").description("主人想多久检查一次动态呢?这里填写 cron 表达式~太短太频繁会吓到女仆的,请温柔一点 (〃ノωノ)"),
|
|
118
|
+
dynamicVideoUrlToBV: koishi.Schema.boolean().default(false).description("如果是视频动态,开启后会把链接换成 BV 号哦~方便主人的其他用途 (*´・ω・`)"),
|
|
119
|
+
pushImgsInDynamic: koishi.Schema.boolean().default(false).description("要不要把动态里的图片也一起推送呢?但、但是可能会触发 QQ 的风控,女仆会有点害怕 (;>_<) 请主人小心决定…"),
|
|
120
|
+
live: koishi.Schema.object({}).description("这里是直播相关的设置~女仆会盯紧 UP 的直播情况的 (*>ω<)"),
|
|
121
|
+
wordcloudStopWords: koishi.Schema.string().description("这里可以填写词云生成时要忽略的词~用英文逗号分隔哦!女仆会乖乖把这些词过滤掉的 (๑•̀ㅂ•́)و✧"),
|
|
122
122
|
liveSummary: koishi.Schema.array(String).default([
|
|
123
123
|
"🔍【弹幕情报站】本场直播数据如下:",
|
|
124
124
|
"🧍♂️ 总共 -dmc 位-mdn上线",
|
|
@@ -130,39 +130,39 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
130
130
|
"🥉 -un3 - -dc3 条精准狙击",
|
|
131
131
|
"🎖️ 特别嘉奖:-un4 & -un5",
|
|
132
132
|
"你们的弹幕,我们都记录在案!🕵️♀️"
|
|
133
|
-
]).role("table").description("
|
|
134
|
-
customGuardBuy: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("
|
|
133
|
+
]).role("table").description("这里可以自定义直播总结的模版~每一行就是一段内容,女仆会按主人写的格式发送哦 (〃´-`〃)♡变量说明也在下面,主人随意发挥吧!变量解释:-dmc代表总弹幕发送人数,-mdn代表主播粉丝牌子名,-dca代表总弹幕数,-un1到-un5代表弹幕发送条数前五名用户的用户名,-dc1到-dc5代表弹幕发送条数前五名的弹幕发送数量,数组每一行代表换行"),
|
|
134
|
+
customGuardBuy: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("要不要让女仆开启自定义上舰消息呢?(゚▽゚)") }), koishi.Schema.union([koishi.Schema.object({
|
|
135
135
|
enable: koishi.Schema.const(true).required(),
|
|
136
|
-
guardBuyMsg: koishi.Schema.string().default("【-mname的直播间】-uname加入了大航海(-guard)").description("
|
|
137
|
-
captainImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/captain-Bjw5Byb5.png").description("
|
|
138
|
-
supervisorImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/supervisor-u43ElIjU.png").description("
|
|
139
|
-
governorImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/governor-DpDXKEdA.png").description("
|
|
136
|
+
guardBuyMsg: koishi.Schema.string().default("【-mname的直播间】-uname加入了大航海(-guard)").description("这里可以自定义上舰提示内容~-uname 是用户名,-muname 是主播名,-guard 是舰长类型哒!女仆会甜甜地发送给主人的群里 (〃ノωノ)♡"),
|
|
137
|
+
captainImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/captain-Bjw5Byb5.png").description("舰长图片链接,这是对应舰长阶级的图片链接~女仆会把它贴在推送里,让消息更好看(*´∀`)~♡"),
|
|
138
|
+
supervisorImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/supervisor-u43ElIjU.png").description("提督图片链接,这是对应舰长阶级的图片链接~女仆会把它贴在推送里,让消息更好看(*´∀`)~♡"),
|
|
139
|
+
governorImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/governor-DpDXKEdA.png").description("总督图片链接,这是对应舰长阶级的图片链接~女仆会把它贴在推送里,让消息更好看(*´∀`)~♡")
|
|
140
140
|
}), koishi.Schema.object({})])]),
|
|
141
|
-
restartPush: koishi.Schema.boolean().default(true).description("
|
|
142
|
-
pushTime: koishi.Schema.number().min(0).max(12).step(.5).default(1).description("
|
|
143
|
-
customLiveStart: koishi.Schema.string().default("-name开播啦,当前粉丝数:-follower\\n-link").description("
|
|
144
|
-
customLive: koishi.Schema.string().default("-name正在直播,目前已播-time,累计观看人数:-watched\\n-link").description("
|
|
145
|
-
customLiveEnd: koishi.Schema.string().default("-name下播啦,本次直播了-time,粉丝数变化-follower_change").description("
|
|
146
|
-
followerDisplay: koishi.Schema.boolean().default(true).description("
|
|
147
|
-
hideDesc: koishi.Schema.boolean().default(false).description("
|
|
148
|
-
style: koishi.Schema.object({}).description("
|
|
149
|
-
removeBorder: koishi.Schema.boolean().default(false).description("
|
|
150
|
-
cardColorStart: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#F38AB5").description("
|
|
151
|
-
cardColorEnd: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#F9CCDF").description("
|
|
152
|
-
cardBasePlateColor: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#FFF5EE").description("
|
|
153
|
-
cardBasePlateBorder: koishi.Schema.string().pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/).default("15px").description("
|
|
154
|
-
enableLargeFont: koishi.Schema.boolean().default(false).description("
|
|
155
|
-
font: koishi.Schema.string().description("
|
|
156
|
-
filter: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("
|
|
141
|
+
restartPush: koishi.Schema.boolean().default(true).description("插件重启后,如果 UP 正在直播,要不要马上推送一次呢?默认是会推送的~女仆会第一时间报告给主人的!"),
|
|
142
|
+
pushTime: koishi.Schema.number().min(0).max(12).step(.5).default(1).description("主人想多长时间推送一次直播状态呢?单位是小时,女仆会按主人的节奏努力工作的 (๑•̀ㅂ•́)و✧"),
|
|
143
|
+
customLiveStart: koishi.Schema.string().default("-name开播啦,当前粉丝数:-follower\\n-link").description("这是开播提示语的自定义格式~女仆会把 -name、-follower、-link 都替换成真实数据送给主人 (〃´-`〃)♡,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"),
|
|
144
|
+
customLive: koishi.Schema.string().default("-name正在直播,目前已播-time,累计观看人数:-watched\\n-link").description("直播中提示语的自定义内容在这里~-name、-time、-watched 都会由女仆乖乖替换哒!-name代表UP昵称,-time代表开播时长,-watched代表累计观看人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name正在直播,会发送为xxxUP正在直播xxx"),
|
|
145
|
+
customLiveEnd: koishi.Schema.string().default("-name下播啦,本次直播了-time,粉丝数变化-follower_change").description("下播提示语的设定~-time、-follower_change 等变量女仆都会帮主人处理好 (*´∀`),-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长,\\n为换行。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
|
|
146
|
+
followerDisplay: koishi.Schema.boolean().default(true).description("要不要显示粉丝变化和累计观看人数在推送卡片呢?女仆可以帮忙统计哒 (๑•̀ㅂ•́)و✧"),
|
|
147
|
+
hideDesc: koishi.Schema.boolean().default(false).description("开启后会隐藏直播间简介~让推送卡片更简洁!女仆会照做的!"),
|
|
148
|
+
style: koishi.Schema.object({}).description("这里是美化设置,让女仆把推送卡片变得漂漂亮亮 (〃ノωノ)♡"),
|
|
149
|
+
removeBorder: koishi.Schema.boolean().default(false).description("要不要把卡片边框移除呢?女仆可以帮忙裁掉 (`・ω・´)!"),
|
|
150
|
+
cardColorStart: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#F38AB5").description("这是推送卡片的渐变颜色开始设置~主人喜欢什么颜色,女仆就用什么颜色 (〃´-`〃)♡"),
|
|
151
|
+
cardColorEnd: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#F9CCDF").description("这是推送卡片的渐变颜色结束设置~主人喜欢什么颜色,女仆就用什么颜色 (〃´-`〃)♡”"),
|
|
152
|
+
cardBasePlateColor: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#FFF5EE").description("底板的颜色在这里设置~请主人随意挑选喜欢的颜色!"),
|
|
153
|
+
cardBasePlateBorder: koishi.Schema.string().pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/).default("15px").description("底板边框的宽度~请填 CSS 单位喔!女仆会乖乖画出这个边框 (*>ω<)b"),
|
|
154
|
+
enableLargeFont: koishi.Schema.boolean().default(false).description("要不要开启大字体模式呢?大字体更好读,小字体更可爱……无论哪种女仆都支持主人的选择 (〃ノωノ)"),
|
|
155
|
+
font: koishi.Schema.string().description("如果主人想用自己的专属字体,可以在这里填写名字~女仆会努力让推送卡片变得更有主人的风格 (´。• ᵕ •。`) ♡"),
|
|
156
|
+
filter: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("要开启吗?") }).description("这里是动态屏蔽设置~如果有不想看到的内容,女仆可以帮主人过滤掉 (>﹏<)!"), koishi.Schema.union([koishi.Schema.object({
|
|
157
157
|
enable: koishi.Schema.const(true).required(),
|
|
158
|
-
notify: koishi.Schema.boolean().default(false).description("
|
|
159
|
-
regex: koishi.Schema.string().description("
|
|
160
|
-
keywords: koishi.Schema.array(String).description("
|
|
161
|
-
forward: koishi.Schema.boolean().default(false).description("
|
|
162
|
-
article: koishi.Schema.boolean().default(false).description("
|
|
158
|
+
notify: koishi.Schema.boolean().default(false).description("当动态被屏蔽时,要不要让女仆通知主人呢?"),
|
|
159
|
+
regex: koishi.Schema.string().description("这里可以填写正则表达式,用来屏蔽特定动态~女仆会努力匹配的!"),
|
|
160
|
+
keywords: koishi.Schema.array(String).description("这里填写关键字,每一个都是单独的一项~有这些词的动态女仆都会贴心地拦下来 (*´∀`)"),
|
|
161
|
+
forward: koishi.Schema.boolean().default(false).description("要不要屏蔽转发动态呢?主人说了算!"),
|
|
162
|
+
article: koishi.Schema.boolean().default(false).description("是否屏蔽专栏动态~女仆会按照主人的喜好来处理 (๑•̀ㅂ•́)و✧")
|
|
163
163
|
}), koishi.Schema.object({})])]),
|
|
164
|
-
debug: koishi.Schema.object({}).description("
|
|
165
|
-
dynamicDebugMode: koishi.Schema.boolean().default(false).description("
|
|
164
|
+
debug: koishi.Schema.object({}).description("这里是调试功能区域~如果主人需要排查问题,女仆会乖乖协助 (;>_<)"),
|
|
165
|
+
dynamicDebugMode: koishi.Schema.boolean().default(false).description("开启后会在控制台输出详细的动态调试信息~主人需要的话女仆会毫不保留全都告诉您!")
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
//#endregion
|
|
@@ -478,8 +478,8 @@ var ComRegister = class ComRegister {
|
|
|
478
478
|
return this.subShow();
|
|
479
479
|
});
|
|
480
480
|
biliCom.subcommand(".private", "向主人账号发送一条测试消息", { hidden: true }).usage("向主人账号发送一条测试消息").example("bili private 向主人账号发送一条测试消息").action(async ({ session }) => {
|
|
481
|
-
await this.sendPrivateMsg(
|
|
482
|
-
await session.send("
|
|
481
|
+
await this.sendPrivateMsg(`主人~女仆向您问好啦!Ciallo~(∠・ω< )⌒★乖乖打招呼呀 (>ω<)♡`);
|
|
482
|
+
await session.send("主人~女仆已经发送消息啦~如果主人没收到,可能是机器人不支持发送私聊消息,或者主人填写的信息有误哦 (>ω<)♡");
|
|
483
483
|
});
|
|
484
484
|
biliCom.subcommand(".ll").usage("展示当前正在直播的订阅对象").example("bili ll").action(async () => {
|
|
485
485
|
const { data: { live_users } } = await ctx["bilibili-notify-api"].getTheUserWhoIsLiveStreaming();
|
|
@@ -508,22 +508,22 @@ var ComRegister = class ComRegister {
|
|
|
508
508
|
return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item);
|
|
509
509
|
}, 1).catch(async (e) => {
|
|
510
510
|
if (e.message === "直播开播动态,不做处理") {
|
|
511
|
-
await session.send("
|
|
511
|
+
await session.send("主人~女仆发现直播开播动态啦,但女仆不处理哦 (>ω<)♡");
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
514
|
if (e.message === "出现关键词,屏蔽该动态") {
|
|
515
|
-
await session.send("
|
|
515
|
+
await session.send("主人~女仆已经屏蔽了这条动态啦 (>ω<)♡");
|
|
516
516
|
return;
|
|
517
517
|
}
|
|
518
518
|
if (e.message === "已屏蔽转发动态") {
|
|
519
|
-
await session.send("
|
|
519
|
+
await session.send("主人~女仆已经屏蔽了这条转发动态啦 (>ω<)♡");
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
522
|
if (e.message === "已屏蔽专栏动态") {
|
|
523
|
-
await session.send("
|
|
523
|
+
await session.send("主人~女仆已经屏蔽了这条专栏动态啦 (>ω<)♡");
|
|
524
524
|
return;
|
|
525
525
|
}
|
|
526
|
-
this.logger.error(
|
|
526
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect generateDynamicImg() 时推送卡片发送失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
527
527
|
});
|
|
528
528
|
buffer && await session.send(koishi.h.image(buffer, "image/jpeg"));
|
|
529
529
|
});
|
|
@@ -637,22 +637,22 @@ var ComRegister = class ComRegister {
|
|
|
637
637
|
data: await this.ctx["bilibili-notify-api"].getUserInfo("114514")
|
|
638
638
|
};
|
|
639
639
|
}).then((content) => content.data);
|
|
640
|
-
if (userInfoCode !== -352 || !userInfoData.v_voucher) return "
|
|
640
|
+
if (userInfoCode !== -352 || !userInfoData.v_voucher) return "主人~女仆发现不满足验证条件呢~所以这个命令不用执行哦 (>ω<)♡ 如果提示风控,主人可以尝试重启插件看看呀 (*>ω<)b";
|
|
641
641
|
const { data } = await ctx["bilibili-notify-api"].v_voucherCaptcha(userInfoData.v_voucher);
|
|
642
|
-
if (!data.geetest) return "
|
|
643
|
-
await session.send("
|
|
644
|
-
await session.send("
|
|
642
|
+
if (!data.geetest) return "主人呜呜 (;>_<) 女仆发现当前风控无法通过验证解除哦~主人可能需要考虑人工申诉呢 (>ω<)♡";
|
|
643
|
+
await session.send("主人~请到这个网站进行验证操作哦~乖乖跟着做,女仆也会帮主人关注进度呢 (〃>ω<〃) https://kuresaru.github.io/geetest-validator/");
|
|
644
|
+
await session.send("主人~请手动填入 gt 和 challenge,然后点击生成进行验证哦~验证完成后再点击结果,并根据提示输入对应的 validate,女仆会在一旁乖乖等主人完成呢 (>ω<)♡");
|
|
645
645
|
await session.send(`gt:${data.geetest.gt}`);
|
|
646
646
|
await session.send(`challenge:${data.geetest.challenge}`);
|
|
647
|
-
await session.send("
|
|
647
|
+
await session.send("主人~验证完成啦~请直接输入 validate 告诉女仆哦 (>ω<)♡");
|
|
648
648
|
const validate = await session.prompt();
|
|
649
649
|
const seccode = `${validate}|jordan`;
|
|
650
650
|
const { data: validateCaptchaData } = await ctx["bilibili-notify-api"].validateCaptcha(data.geetest.challenge, data.token, validate, seccode);
|
|
651
|
-
if (validateCaptchaData?.is_valid !== 1) return "
|
|
651
|
+
if (validateCaptchaData?.is_valid !== 1) return "主人呜呜 (;>_<) 验证没有成功呢~请主人再试一次呀 (>ω<)♡";
|
|
652
652
|
await this.ctx.sleep(10 * 1e3);
|
|
653
653
|
const { code: validCode, data: validData } = await ctx["bilibili-notify-api"].getUserInfo("114514", validateCaptchaData.grisk_id);
|
|
654
|
-
if (validCode === -352 && validData.v_voucher) return "
|
|
655
|
-
await session.send("
|
|
654
|
+
if (validCode === -352 && validData.v_voucher) return "主人呜呜 (;>_<) 验证没有成功呢~请主人再试一次呀 (>ω<)♡";
|
|
655
|
+
await session.send("主人~验证成功啦!请主人重启插件,女仆会乖乖继续工作哦 (>ω<)♡");
|
|
656
656
|
});
|
|
657
657
|
biliCom.subcommand(".ai").action(async () => {
|
|
658
658
|
this.logger.info("开始生成AI直播总结");
|
|
@@ -714,21 +714,21 @@ var ComRegister = class ComRegister {
|
|
|
714
714
|
}
|
|
715
715
|
async init(config) {
|
|
716
716
|
this.logger = this.ctx.logger("bilibili-notify-core");
|
|
717
|
-
this.logger.info("
|
|
717
|
+
this.logger.info("主人~女仆正在努力初始化插件中呢…请稍等一下哦 (>///<)♡");
|
|
718
718
|
this.config = config;
|
|
719
719
|
this.registeringForEvents();
|
|
720
720
|
this.privateBot = this.ctx.bots.find((bot) => bot.platform === config.master.platform);
|
|
721
|
-
if (!this.privateBot) this.ctx.notifier.create({ content: "
|
|
721
|
+
if (!this.privateBot) this.ctx.notifier.create({ content: "主人呜呜 (;>_<) 您还没有配置主人账号呢~女仆没办法向您推送插件运行状态啦,请快点配置哦 (>ω<)♡" });
|
|
722
722
|
this.loginDBData = (await this.ctx.database.get("loginBili", 1, ["dynamic_group_id"]))[0];
|
|
723
723
|
await this.checkIfLoginInfoIsLoaded();
|
|
724
724
|
if (!await this.checkIfIsLogin()) {
|
|
725
|
-
this.logger.info("
|
|
725
|
+
this.logger.info("主人…呜呜 (;>_<) 女仆发现账号还没登录呢,请主人快点登录好让女仆继续工作呀 (>ω<)♡");
|
|
726
726
|
return;
|
|
727
727
|
}
|
|
728
728
|
const personalInfo = await this.ctx["bilibili-notify-api"].getMyselfInfo();
|
|
729
729
|
if (personalInfo.code !== 0) this.ctx.emit("bilibili-notify/login-status-report", {
|
|
730
730
|
status: BiliLoginStatus.LOGGED_IN,
|
|
731
|
-
msg: "
|
|
731
|
+
msg: "主人…呜呜 (;>_<) 虽然账号已登录,但女仆获取个人信息失败啦,请主人检查一下呀 (>ω<)♡"
|
|
732
732
|
});
|
|
733
733
|
const myCardInfo = await this.ctx["bilibili-notify-api"].getUserCardInfo(personalInfo.data.mid.toString(), true);
|
|
734
734
|
this.ctx.emit("bilibili-notify/login-status-report", {
|
|
@@ -739,25 +739,92 @@ var ComRegister = class ComRegister {
|
|
|
739
739
|
this.mergeStopWords(config.wordcloudStopWords);
|
|
740
740
|
this.initAllManager();
|
|
741
741
|
if (config.advancedSub) {
|
|
742
|
-
this.logger.info("
|
|
742
|
+
this.logger.info("主人~女仆正在开启高级订阅呢,请稍等一下,女仆乖乖加载订阅中哦 (>///<)♡");
|
|
743
743
|
this.ctx.emit("bilibili-notify/ready-to-recive");
|
|
744
744
|
} else if (config.subs && config.subs.length > 0) {
|
|
745
745
|
const subs = this.configSubsToSubscription(config.subs);
|
|
746
746
|
await this.initAsyncPart(subs);
|
|
747
|
-
} else this.logger.info("
|
|
747
|
+
} else this.logger.info("主人~女仆初始化完毕啦,但发现还没有添加任何订阅呢 (>_<) 请快点添加,让女仆可以开始努力工作呀♡");
|
|
748
|
+
}
|
|
749
|
+
preInitConfig(subs) {
|
|
750
|
+
for (const sub of Object.values(subs)) {
|
|
751
|
+
if (sub.customLiveMsg.enable) {
|
|
752
|
+
if (!sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
753
|
+
if (!sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
754
|
+
if (!sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
755
|
+
} else {
|
|
756
|
+
sub.customLiveMsg.enable = false;
|
|
757
|
+
sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
758
|
+
sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
759
|
+
sub.customLiveMsg.customLive = this.config.customLive;
|
|
760
|
+
}
|
|
761
|
+
if (sub.customGuardBuy.enable) {
|
|
762
|
+
if (!sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
763
|
+
if (!sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
764
|
+
if (!sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
765
|
+
if (!sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
766
|
+
} else if (this.config.customGuardBuy.enable) {
|
|
767
|
+
sub.customGuardBuy.enable = true;
|
|
768
|
+
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
769
|
+
sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
770
|
+
sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
771
|
+
sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
772
|
+
}
|
|
773
|
+
if (sub.customLiveSummary.enable) {
|
|
774
|
+
if (sub.customLiveSummary.liveSummary.length === 0) sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
775
|
+
} else {
|
|
776
|
+
sub.customLiveSummary.enable = false;
|
|
777
|
+
sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
778
|
+
}
|
|
779
|
+
const dynamicArr = [];
|
|
780
|
+
const dynamicAtAllArr = [];
|
|
781
|
+
const liveArr = [];
|
|
782
|
+
const liveAtAllArr = [];
|
|
783
|
+
const liveGuardBuyArr = [];
|
|
784
|
+
const superchatArr = [];
|
|
785
|
+
const wordcloudArr = [];
|
|
786
|
+
const liveSummaryArr = [];
|
|
787
|
+
for (const platform of sub.target) for (const channel of platform.channelArr) {
|
|
788
|
+
const target = `${platform.platform}:${channel.channelId}`;
|
|
789
|
+
const conditions = [
|
|
790
|
+
["dynamic", dynamicArr],
|
|
791
|
+
["dynamicAtAll", dynamicAtAllArr],
|
|
792
|
+
["live", liveArr],
|
|
793
|
+
["liveAtAll", liveAtAllArr],
|
|
794
|
+
["liveGuardBuy", liveGuardBuyArr],
|
|
795
|
+
["superchat", superchatArr],
|
|
796
|
+
["wordcloud", wordcloudArr],
|
|
797
|
+
["liveSummary", liveSummaryArr]
|
|
798
|
+
];
|
|
799
|
+
for (const [key, arr] of conditions) if (channel[key]) arr.push(target);
|
|
800
|
+
}
|
|
801
|
+
this.pushArrMap.set(sub.uid, {
|
|
802
|
+
dynamicArr,
|
|
803
|
+
dynamicAtAllArr,
|
|
804
|
+
liveArr,
|
|
805
|
+
liveAtAllArr,
|
|
806
|
+
liveSummaryArr,
|
|
807
|
+
liveGuardBuyArr,
|
|
808
|
+
superchatArr,
|
|
809
|
+
wordcloudArr
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
this.logger.info("主人~女仆正在初始化推送群组/频道信息呢,请稍等一下哦 (>ω<)♡");
|
|
813
|
+
this.logger.info(this.pushArrMap);
|
|
748
814
|
}
|
|
749
815
|
registeringForEvents() {
|
|
750
816
|
this.ctx.console.addListener("bilibili-notify/start-login", async () => {
|
|
751
|
-
this.logger.info("
|
|
817
|
+
this.logger.info("主人~女仆正在触发登录事件呢,请稍等一下哦 (>ω<)♡");
|
|
752
818
|
let content;
|
|
753
819
|
try {
|
|
754
820
|
content = await this.ctx["bilibili-notify-api"].getLoginQRCode();
|
|
755
821
|
} catch (_) {
|
|
756
|
-
|
|
822
|
+
this.logger.error("主人呜呜 (;>_<) 女仆在请求 bili login getLoginQRCode() 的时候网络失败啦,请检查网络后再试呀 (>ω<)♡");
|
|
823
|
+
return;
|
|
757
824
|
}
|
|
758
825
|
if (content.code !== 0) return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
759
826
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
760
|
-
msg:
|
|
827
|
+
msg: `主人…呜呜 (;>_<) 女仆获取二维码失败啦,请主人再试一次哦 (>ω<)♡`
|
|
761
828
|
});
|
|
762
829
|
qrcode.default.toBuffer(content.data.url, {
|
|
763
830
|
errorCorrectionLevel: "H",
|
|
@@ -769,10 +836,10 @@ var ComRegister = class ComRegister {
|
|
|
769
836
|
}
|
|
770
837
|
}, async (err, buffer) => {
|
|
771
838
|
if (err) {
|
|
772
|
-
this.logger.error(
|
|
839
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆生成二维码失败啦~错误信息:${err},请主人帮女仆看看问题呀 (>ω<)♡`);
|
|
773
840
|
return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
774
841
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
775
|
-
msg: "
|
|
842
|
+
msg: "主人呜呜 (;>_<) 女仆生成二维码失败啦~"
|
|
776
843
|
});
|
|
777
844
|
}
|
|
778
845
|
const url = `data:image/png;base64,${Buffer.from(buffer).toString("base64")}`;
|
|
@@ -792,22 +859,22 @@ var ComRegister = class ComRegister {
|
|
|
792
859
|
try {
|
|
793
860
|
loginContent = await this.ctx["bilibili-notify-api"].getLoginStatus(content.data.qrcode_key);
|
|
794
861
|
} catch (e) {
|
|
795
|
-
this.logger.error(e);
|
|
862
|
+
this.logger.error(`主人…呜呜 (;>_<) 女仆获取登录信息失败啦~错误信息:${e},请主人帮女仆检查一下呀 (>ω<)♡`);
|
|
796
863
|
return;
|
|
797
864
|
}
|
|
798
865
|
if (loginContent.data.code === 86101) return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
799
866
|
status: BiliLoginStatus.LOGGING_QR,
|
|
800
|
-
msg: "
|
|
867
|
+
msg: "主人~呜呜 (;>_<) 女仆发现您还没有扫码呢,请主人快点扫码呀 (>ω<)♡"
|
|
801
868
|
});
|
|
802
869
|
if (loginContent.data.code === 86090) return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
803
870
|
status: BiliLoginStatus.LOGGING_QR,
|
|
804
|
-
msg: "
|
|
871
|
+
msg: "主人~呜呜 (;>_<) 女仆看到二维码已经扫码了,但还没有确认呢,请主人快点确认呀 (>ω<)♡"
|
|
805
872
|
});
|
|
806
873
|
if (loginContent.data.code === 86038) {
|
|
807
874
|
this.loginTimer();
|
|
808
875
|
return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
809
876
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
810
|
-
msg: "
|
|
877
|
+
msg: "主人呜呜 (;>_<) 女仆发现二维码已经失效啦,请主人重新登录好让女仆继续工作呀 (>ω<)♡"
|
|
811
878
|
});
|
|
812
879
|
}
|
|
813
880
|
if (loginContent.data.code === 0) {
|
|
@@ -825,7 +892,7 @@ var ComRegister = class ComRegister {
|
|
|
825
892
|
this.ctx["bilibili-notify-api"].disposeNotifier();
|
|
826
893
|
this.ctx.emit("bilibili-notify/login-status-report", {
|
|
827
894
|
status: BiliLoginStatus.LOGIN_SUCCESS,
|
|
828
|
-
msg: "
|
|
895
|
+
msg: "主人~女仆看到您已登录啦,请点击按钮重启插件哦~女仆也会在5秒后自动帮您重启的 (>ω<)♡"
|
|
829
896
|
});
|
|
830
897
|
await this.ctx["bilibili-notify"].restartPlugin();
|
|
831
898
|
}
|
|
@@ -833,7 +900,7 @@ var ComRegister = class ComRegister {
|
|
|
833
900
|
this.loginTimer();
|
|
834
901
|
return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
835
902
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
836
|
-
msg: "
|
|
903
|
+
msg: "主人呜呜 (;>_<) 女仆登录失败啦,请主人再试一次,好让女仆继续工作呀 (>ω<)♡"
|
|
837
904
|
});
|
|
838
905
|
}
|
|
839
906
|
} finally {
|
|
@@ -859,7 +926,7 @@ var ComRegister = class ComRegister {
|
|
|
859
926
|
});
|
|
860
927
|
if (this.config.advancedSub) this.ctx.on("bilibili-notify/advanced-sub", async (subs) => {
|
|
861
928
|
if (Object.keys(subs).length === 0) {
|
|
862
|
-
this.logger.info("
|
|
929
|
+
this.logger.info("主人~女仆初始化完毕啦,但发现还没有添加任何订阅呢 (>_<) 请快点添加,让女仆可以开始努力工作呀♡");
|
|
863
930
|
return;
|
|
864
931
|
}
|
|
865
932
|
if (this.reciveSubTimes >= 1) await this.ctx["bilibili-notify"].restartPlugin();
|
|
@@ -875,24 +942,23 @@ var ComRegister = class ComRegister {
|
|
|
875
942
|
}
|
|
876
943
|
async initAsyncPart(subs) {
|
|
877
944
|
this.ctx["bilibili-notify-live"].clearListeners();
|
|
878
|
-
this.logger.info("
|
|
945
|
+
this.logger.info("主人~女仆已经获取到订阅信息啦,正在乖乖开始加载订阅中哦 (>ω<)♡");
|
|
879
946
|
const groupInfoResult = await this.getGroupInfo();
|
|
880
947
|
if (groupInfoResult.code !== 0) {
|
|
881
|
-
this.logger.error("
|
|
948
|
+
this.logger.error("主人呜呜 (;>_<) 女仆获取分组信息失败啦,插件初始化失败…请主人帮女仆看看问题呀 (>ω<)♡");
|
|
882
949
|
return;
|
|
883
950
|
}
|
|
884
951
|
this.groupInfo = groupInfoResult.data;
|
|
885
952
|
const { code, message } = await this.loadSubFromConfig(subs);
|
|
886
953
|
if (code !== 0) {
|
|
887
|
-
this.logger.error(message);
|
|
888
|
-
this.
|
|
889
|
-
await this.sendPrivateMsg("订阅对象加载失败,插件初始化失败!");
|
|
954
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆加载订阅对象失败啦,插件初始化失败~错误信息:${message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
955
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆加载订阅对象失败啦,插件初始化失败~");
|
|
890
956
|
return;
|
|
891
957
|
}
|
|
892
958
|
this.initManagerAfterLoadSub();
|
|
893
959
|
this.checkIfDynamicDetectIsNeeded();
|
|
894
960
|
this.updateSubNotifier();
|
|
895
|
-
this.logger.info("
|
|
961
|
+
this.logger.info("主人~女仆插件初始化完毕啦!乖乖准备好为您服务哦 (>ω<)♡");
|
|
896
962
|
}
|
|
897
963
|
mergeStopWords(stopWordsStr) {
|
|
898
964
|
if (!stopWordsStr || stopWordsStr.trim() === "") {
|
|
@@ -965,7 +1031,7 @@ var ComRegister = class ComRegister {
|
|
|
965
1031
|
async sendPrivateMsg(content) {
|
|
966
1032
|
if (this.config.master.enable) {
|
|
967
1033
|
if (this.privateBot?.status !== koishi.Universal.Status.ONLINE) {
|
|
968
|
-
this.logger.error(
|
|
1034
|
+
this.logger.error(`主人~呜呜 (;>_<) 女仆发现 ${this.privateBot.platform} 机器人还没初始化完毕呢,暂时不能进行推送~女仆会乖乖等它准备好 (>ω<)♡`);
|
|
969
1035
|
return;
|
|
970
1036
|
}
|
|
971
1037
|
if (this.config.master.masterAccountGuildId) await this.privateBot.sendPrivateMessage(this.config.master.masterAccount, content, this.config.master.masterAccountGuildId);
|
|
@@ -974,23 +1040,23 @@ var ComRegister = class ComRegister {
|
|
|
974
1040
|
}
|
|
975
1041
|
async sendPrivateMsgAndRebootService() {
|
|
976
1042
|
if (this.rebootCount >= 3) {
|
|
977
|
-
this.logger.error("
|
|
978
|
-
await this.sendPrivateMsg("
|
|
1043
|
+
this.logger.error("主人呜呜 (;>_<) 女仆已经重启插件三次啦,请主人检查一下机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
1044
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆已经重启插件三次啦,请主人检查一下机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
979
1045
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
980
1046
|
return;
|
|
981
1047
|
}
|
|
982
1048
|
this.rebootCount++;
|
|
983
|
-
this.logger.info("
|
|
984
|
-
if (await this.ctx["bilibili-notify"].restartPlugin()) this.logger.info("
|
|
1049
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现插件出现未知错误啦,正在乖乖重启插件中~请主人稍等哦 (>ω<)♡");
|
|
1050
|
+
if (await this.ctx["bilibili-notify"].restartPlugin()) this.logger.info("主人~女仆成功重启插件啦!乖乖准备继续为您服务哦 (>ω<)♡");
|
|
985
1051
|
else {
|
|
986
|
-
this.logger.error("
|
|
987
|
-
await this.sendPrivateMsg("
|
|
1052
|
+
this.logger.error("主人呜呜 (;>_<) 女仆重启插件失败啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
1053
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆重启插件失败啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
988
1054
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
989
1055
|
}
|
|
990
1056
|
}
|
|
991
1057
|
async sendPrivateMsgAndStopService() {
|
|
992
|
-
await this.sendPrivateMsg("
|
|
993
|
-
this.logger.error("
|
|
1058
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆发现插件发生未知错误啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
1059
|
+
this.logger.error("主人呜呜 (;>_<) 女仆发现插件发生未知错误啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
994
1060
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
995
1061
|
}
|
|
996
1062
|
async sendMessageWithRetry(bot, channelId, content) {
|
|
@@ -1001,76 +1067,10 @@ var ComRegister = class ComRegister {
|
|
|
1001
1067
|
}, 2e3);
|
|
1002
1068
|
return;
|
|
1003
1069
|
}
|
|
1004
|
-
this.logger.error(
|
|
1005
|
-
await this.sendPrivateMsg(
|
|
1070
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发送群组ID: ${channelId} 的消息失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1071
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发送群组ID: ${channelId} 的消息失败啦~请主人帮女仆看看呀 (>ω<)♡`);
|
|
1006
1072
|
});
|
|
1007
1073
|
}
|
|
1008
|
-
preInitConfig(subs) {
|
|
1009
|
-
for (const sub of Object.values(subs)) {
|
|
1010
|
-
if (sub.customLiveMsg.enable) {
|
|
1011
|
-
if (!sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
1012
|
-
if (!sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
1013
|
-
if (!sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
1014
|
-
} else {
|
|
1015
|
-
sub.customLiveMsg.enable = false;
|
|
1016
|
-
sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
1017
|
-
sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
1018
|
-
sub.customLiveMsg.customLive = this.config.customLive;
|
|
1019
|
-
}
|
|
1020
|
-
if (sub.customGuardBuy.enable) {
|
|
1021
|
-
if (!sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
1022
|
-
if (!sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
1023
|
-
if (!sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
1024
|
-
if (!sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
1025
|
-
} else if (this.config.customGuardBuy.enable) {
|
|
1026
|
-
sub.customGuardBuy.enable = true;
|
|
1027
|
-
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
1028
|
-
sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
1029
|
-
sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
1030
|
-
sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
1031
|
-
}
|
|
1032
|
-
if (sub.customLiveSummary.enable) {
|
|
1033
|
-
if (!sub.customLiveSummary.liveSummary.trim()) sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
1034
|
-
} else {
|
|
1035
|
-
sub.customLiveSummary.enable = false;
|
|
1036
|
-
sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
1037
|
-
}
|
|
1038
|
-
const dynamicArr = [];
|
|
1039
|
-
const dynamicAtAllArr = [];
|
|
1040
|
-
const liveArr = [];
|
|
1041
|
-
const liveAtAllArr = [];
|
|
1042
|
-
const liveGuardBuyArr = [];
|
|
1043
|
-
const superchatArr = [];
|
|
1044
|
-
const wordcloudArr = [];
|
|
1045
|
-
const liveSummaryArr = [];
|
|
1046
|
-
for (const platform of sub.target) for (const channel of platform.channelArr) {
|
|
1047
|
-
const target = `${platform.platform}:${channel.channelId}`;
|
|
1048
|
-
const conditions = [
|
|
1049
|
-
["dynamic", dynamicArr],
|
|
1050
|
-
["dynamicAtAll", dynamicAtAllArr],
|
|
1051
|
-
["live", liveArr],
|
|
1052
|
-
["liveAtAll", liveAtAllArr],
|
|
1053
|
-
["liveGuardBuy", liveGuardBuyArr],
|
|
1054
|
-
["superchat", superchatArr],
|
|
1055
|
-
["wordcloud", wordcloudArr],
|
|
1056
|
-
["liveSummary", liveSummaryArr]
|
|
1057
|
-
];
|
|
1058
|
-
for (const [key, arr] of conditions) if (channel[key]) arr.push(target);
|
|
1059
|
-
}
|
|
1060
|
-
this.pushArrMap.set(sub.uid, {
|
|
1061
|
-
dynamicArr,
|
|
1062
|
-
dynamicAtAllArr,
|
|
1063
|
-
liveArr,
|
|
1064
|
-
liveAtAllArr,
|
|
1065
|
-
liveSummaryArr,
|
|
1066
|
-
liveGuardBuyArr,
|
|
1067
|
-
superchatArr,
|
|
1068
|
-
wordcloudArr
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
this.logger.info("初始化推送群组/频道信息:");
|
|
1072
|
-
this.logger.info(this.pushArrMap);
|
|
1073
|
-
}
|
|
1074
1074
|
async pushMessage(targets, content) {
|
|
1075
1075
|
const t = {};
|
|
1076
1076
|
for (const target of targets) {
|
|
@@ -1084,16 +1084,16 @@ var ComRegister = class ComRegister {
|
|
|
1084
1084
|
let num = 0;
|
|
1085
1085
|
const sendMessageByBot = async (channelId, botIndex = 0, retry = 3e3) => {
|
|
1086
1086
|
if (!bots[botIndex]) {
|
|
1087
|
-
this.logger.warn(
|
|
1087
|
+
this.logger.warn(`主人呜呜 (;>_<) 女仆发现 ${platform} 没有配置对应机器人呢,暂时无法进行推送哦 (>ω<)♡`);
|
|
1088
1088
|
return;
|
|
1089
1089
|
}
|
|
1090
1090
|
if (bots[botIndex].status !== koishi.Universal.Status.ONLINE) {
|
|
1091
1091
|
if (retry >= 3e3 * 2 ** 5) {
|
|
1092
|
-
this.logger.error(
|
|
1093
|
-
await this.sendPrivateMsg(
|
|
1092
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发现 ${platform} 机器人还没初始化完毕呢~已经重试5次啦,暂时放弃推送了 (>ω<)♡`);
|
|
1093
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发现 ${platform} 机器人还没初始化完毕呢~已经重试5次啦,暂时放弃推送了 (>ω<)♡`);
|
|
1094
1094
|
return;
|
|
1095
1095
|
}
|
|
1096
|
-
this.logger.error(
|
|
1096
|
+
this.logger.error(`主人~女仆发现 ${platform} 机器人还没初始化完毕呢,暂时无法推送~${retry / 1e3} 秒后女仆会再试一次哦 (>ω<)♡`);
|
|
1097
1097
|
await this.ctx.sleep(retry);
|
|
1098
1098
|
await sendMessageByBot(channelId, botIndex, retry * 2);
|
|
1099
1099
|
return;
|
|
@@ -1103,46 +1103,46 @@ var ComRegister = class ComRegister {
|
|
|
1103
1103
|
num++;
|
|
1104
1104
|
await this.ctx.sleep(500);
|
|
1105
1105
|
} catch (e) {
|
|
1106
|
-
this.logger.error(e);
|
|
1106
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆遇到错误啦~错误信息:${e},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1107
1107
|
if (bots.length > 1) await sendMessageByBot(channelId, botIndex++);
|
|
1108
1108
|
}
|
|
1109
1109
|
};
|
|
1110
1110
|
for (const channelId of t[platform]) await sendMessageByBot(channelId);
|
|
1111
|
-
this.logger.info(
|
|
1111
|
+
this.logger.info(`主人~女仆成功推送了 ${num} 条消息啦!乖乖完成任务~(>ω<)♡`);
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
1114
|
async broadcastToTargets(uid, content, type) {
|
|
1115
1115
|
const record = this.pushArrMap.get(uid);
|
|
1116
1116
|
if (!record) return;
|
|
1117
1117
|
if (!(type === PushType.StartBroadcasting && record.liveAtAllArr?.length > 0 || type === PushType.Dynamic && (record.dynamicArr?.length > 0 || record.dynamicAtAllArr?.length > 0) || (type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length > 0 || type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length > 0 || type === PushType.Superchat && record.superchatArr?.length > 0 || type === PushType.WordCloudAndLiveSummary && (record.wordcloudArr?.length > 0 || record.liveSummaryArr?.length > 0))) return;
|
|
1118
|
-
this.logger.info(
|
|
1118
|
+
this.logger.info(`主人~女仆这次要推送的对象是 ${uid},推送类型是 ${PushTypeMsg[type]} 哦~乖乖完成任务啦 (>ω<)♡`);
|
|
1119
1119
|
if (type === PushType.StartBroadcasting && record.liveAtAllArr?.length > 0) {
|
|
1120
|
-
this.logger.info(
|
|
1120
|
+
this.logger.info(`主人~女仆推送给 @全体 的消息啦~对象列表:${record.liveAtAllArr} 哦 (>ω<)♡`);
|
|
1121
1121
|
const atAllArr = structuredClone(record.liveAtAllArr);
|
|
1122
1122
|
await withRetry(() => this.pushMessage(atAllArr, koishi.h.at("all")), 1);
|
|
1123
1123
|
}
|
|
1124
1124
|
if (type === PushType.Dynamic && record.dynamicArr?.length > 0) {
|
|
1125
1125
|
if (record.dynamicAtAllArr?.length > 0) {
|
|
1126
|
-
this.logger.info(
|
|
1126
|
+
this.logger.info(`主人~女仆推送动态给 @全体 哦~对象列表:${record.dynamicAtAllArr} (>ω<)♡`);
|
|
1127
1127
|
const dynamicAtAllArr = structuredClone(record.dynamicAtAllArr);
|
|
1128
1128
|
await withRetry(() => this.pushMessage(dynamicAtAllArr, koishi.h.at("all")), 1);
|
|
1129
1129
|
}
|
|
1130
|
-
this.logger.info(
|
|
1130
|
+
this.logger.info(`主人~女仆正在推送动态啦~对象列表:${record.dynamicArr} (>ω<)♡`);
|
|
1131
1131
|
const dynamicArr = structuredClone(record.dynamicArr);
|
|
1132
1132
|
await withRetry(() => this.pushMessage(dynamicArr, (0, koishi.h)("message", content)), 1);
|
|
1133
1133
|
}
|
|
1134
1134
|
if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length > 0) {
|
|
1135
|
-
this.logger.info(
|
|
1135
|
+
this.logger.info(`主人~女仆正在推送直播啦~对象列表:${record.liveArr} (>ω<)♡`);
|
|
1136
1136
|
const liveArr = structuredClone(record.liveArr);
|
|
1137
1137
|
await withRetry(() => this.pushMessage(liveArr, (0, koishi.h)("message", content)), 1);
|
|
1138
1138
|
}
|
|
1139
1139
|
if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length > 0) {
|
|
1140
|
-
this.logger.info(
|
|
1140
|
+
this.logger.info(`主人~女仆正在推送直播守护购买消息啦~对象列表:${record.liveGuardBuyArr} (>ω<)♡`);
|
|
1141
1141
|
const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
|
|
1142
1142
|
await withRetry(() => this.pushMessage(liveGuardBuyArr, (0, koishi.h)("message", content)), 1);
|
|
1143
1143
|
}
|
|
1144
1144
|
if (type === PushType.Superchat && record.superchatArr?.length > 0) {
|
|
1145
|
-
this.logger.info(
|
|
1145
|
+
this.logger.info(`主人~女仆正在推送 SC 消息啦~对象列表:${record.superchatArr} (>ω<)♡`);
|
|
1146
1146
|
const superchatArr = structuredClone(record.superchatArr);
|
|
1147
1147
|
await withRetry(() => this.pushMessage(superchatArr, (0, koishi.h)("message", content)), 1);
|
|
1148
1148
|
}
|
|
@@ -1153,16 +1153,16 @@ var ComRegister = class ComRegister {
|
|
|
1153
1153
|
const wordcloudOnlyArr = wordcloudArr.filter((item) => !liveSummaryArr.includes(item));
|
|
1154
1154
|
const liveSummaryOnlyArr = liveSummaryArr.filter((item) => !wordcloudArr.includes(item));
|
|
1155
1155
|
if (wordcloudAndLiveSummaryArr.length > 0) {
|
|
1156
|
-
this.logger.info(
|
|
1156
|
+
this.logger.info(`主人~女仆正在推送词云和直播总结啦~对象列表:${wordcloudAndLiveSummaryArr} (>ω<)♡`);
|
|
1157
1157
|
const msgs = content.filter(Boolean);
|
|
1158
1158
|
if (msgs.length > 0) await withRetry(() => this.pushMessage(wordcloudAndLiveSummaryArr, (0, koishi.h)("message", msgs)), 1);
|
|
1159
1159
|
}
|
|
1160
1160
|
if (content[0] && wordcloudOnlyArr.length > 0) {
|
|
1161
|
-
this.logger.info(
|
|
1161
|
+
this.logger.info(`主人~女仆正在推送词云啦~对象列表:${wordcloudOnlyArr} (>ω<)♡`);
|
|
1162
1162
|
await withRetry(() => this.pushMessage(wordcloudOnlyArr, (0, koishi.h)("message", content[0])), 1);
|
|
1163
1163
|
}
|
|
1164
1164
|
if (content[1] && liveSummaryOnlyArr.length > 0) {
|
|
1165
|
-
this.logger.info(
|
|
1165
|
+
this.logger.info(`主人~女仆正在推送直播总结啦~对象列表:${liveSummaryOnlyArr} (>ω<)♡`);
|
|
1166
1166
|
await withRetry(() => this.pushMessage(liveSummaryOnlyArr, (0, koishi.h)("message", content[1])), 1);
|
|
1167
1167
|
}
|
|
1168
1168
|
}
|
|
@@ -1173,23 +1173,23 @@ var ComRegister = class ComRegister {
|
|
|
1173
1173
|
const content = await withRetry(async () => {
|
|
1174
1174
|
return await this.ctx["bilibili-notify-api"].getAllDynamic();
|
|
1175
1175
|
}, 1).catch((e) => {
|
|
1176
|
-
this.logger.error(
|
|
1176
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect getAllDynamic() 时发生了错误~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1177
1177
|
});
|
|
1178
1178
|
if (!content) return;
|
|
1179
1179
|
if (content.code !== 0) switch (content.code) {
|
|
1180
1180
|
case -101:
|
|
1181
|
-
this.logger.error("
|
|
1182
|
-
await this.sendPrivateMsg("
|
|
1181
|
+
this.logger.error("主人…呜呜,女仆发现您还没登录账号呢 (;>_<)插件已经乖乖停止工作啦…请主人快点登录,让女仆可以继续努力为您服务~ (>ω<)♡");
|
|
1182
|
+
await this.sendPrivateMsg("主人…呜呜,女仆发现您还没登录账号呢 (;>_<)插件已经乖乖停止工作啦…请主人快点登录,让女仆可以继续努力为您服务~ (>ω<)♡");
|
|
1183
1183
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1184
1184
|
break;
|
|
1185
1185
|
case -352:
|
|
1186
|
-
this.logger.error("
|
|
1187
|
-
await this.sendPrivateMsg("
|
|
1186
|
+
this.logger.error("主人…呜呜 (;>_<) 女仆发现账号被风控啦~插件已经乖乖停止工作了…请主人输入指令 bili cap,然后按照提示来解除风控吧~女仆会在旁边乖乖等您完成的 (>ω<)♡");
|
|
1187
|
+
await this.sendPrivateMsg("主人…呜呜 (;>_<) 女仆发现账号被风控啦~插件已经乖乖停止工作了…请主人输入指令 bili cap,然后按照提示来解除风控吧~女仆会在旁边乖乖等您完成的 (>ω<)♡");
|
|
1188
1188
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1189
1189
|
break;
|
|
1190
1190
|
default:
|
|
1191
|
-
this.logger.error(
|
|
1192
|
-
await this.sendPrivateMsg(
|
|
1191
|
+
this.logger.error(`主人…呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件~女仆会乖乖等着的 (>ω<)♡`);
|
|
1192
|
+
await this.sendPrivateMsg(`主人…呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件~女仆会乖乖等着的 (>ω<)♡`);
|
|
1193
1193
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1194
1194
|
break;
|
|
1195
1195
|
}
|
|
@@ -1218,7 +1218,7 @@ var ComRegister = class ComRegister {
|
|
|
1218
1218
|
if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
|
|
1219
1219
|
return;
|
|
1220
1220
|
}
|
|
1221
|
-
this.logger.error(
|
|
1221
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect generateDynamicImg() 时推送卡片发送失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1222
1222
|
await this.sendPrivateMsgAndStopService();
|
|
1223
1223
|
});
|
|
1224
1224
|
if (!buffer) continue;
|
|
@@ -1230,7 +1230,7 @@ var ComRegister = class ComRegister {
|
|
|
1230
1230
|
else dUrl = `${name$2}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
|
|
1231
1231
|
let aigc = "";
|
|
1232
1232
|
if (this.config.ai.enable) {
|
|
1233
|
-
this.logger.info("
|
|
1233
|
+
this.logger.info("主人~女仆正在努力生成 AI 动态推送内容中呢…请稍等一下呀 (>ω<)♡");
|
|
1234
1234
|
if (item.type === "DYNAMIC_TYPE_AV") {
|
|
1235
1235
|
const title = item.modules.module_dynamic.major.archive.title;
|
|
1236
1236
|
const desc = item.modules.module_dynamic.major.archive.desc;
|
|
@@ -1241,9 +1241,9 @@ var ComRegister = class ComRegister {
|
|
|
1241
1241
|
const desc = item.modules.module_dynamic.major.opus.summary.text;
|
|
1242
1242
|
aigc = (await this.ctx["bilibili-notify-api"].chatWithAI(`请你根据以下图文动态的标题和内容,帮我写一份简短的动态播报,标题:${title},内容:${desc}`)).choices[0].message.content;
|
|
1243
1243
|
}
|
|
1244
|
-
this.logger.info(
|
|
1244
|
+
this.logger.info(`主人~女仆的 AI 动态推送内容生成完毕啦!乖乖准备好发送给大家哦 (>ω<)♡`);
|
|
1245
1245
|
}
|
|
1246
|
-
this.logger.info(
|
|
1246
|
+
this.logger.info(`主人~女仆正在推送动态中呢…请稍等哦 (>ω<)♡`);
|
|
1247
1247
|
await this.broadcastToTargets(uid, (0, koishi.h)("message", [
|
|
1248
1248
|
koishi.h.image(buffer, "image/jpeg"),
|
|
1249
1249
|
koishi.h.text(aigc),
|
|
@@ -1259,7 +1259,7 @@ var ComRegister = class ComRegister {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
}
|
|
1261
1261
|
if (!currentPushDyn[uid]) currentPushDyn[uid] = item;
|
|
1262
|
-
this.logger.info(
|
|
1262
|
+
this.logger.info(`主人~女仆的动态推送完毕啦!乖乖完成任务~(>ω<)♡`);
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
@@ -1273,46 +1273,46 @@ var ComRegister = class ComRegister {
|
|
|
1273
1273
|
debug_dynamicDetect() {
|
|
1274
1274
|
const handler = async () => {
|
|
1275
1275
|
const currentPushDyn = {};
|
|
1276
|
-
this.logger.info(
|
|
1276
|
+
this.logger.info(`主人~女仆正在开始获取动态信息呢…请稍等一下呀 (>ω<)♡`);
|
|
1277
1277
|
const content = await withRetry(async () => {
|
|
1278
1278
|
return await this.ctx["bilibili-notify-api"].getAllDynamic();
|
|
1279
1279
|
}, 1).catch((e) => {
|
|
1280
|
-
this.logger.error(
|
|
1280
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect getAllDynamic() 时遇到错误啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1281
1281
|
});
|
|
1282
1282
|
if (!content) return;
|
|
1283
1283
|
if (content.code !== 0) switch (content.code) {
|
|
1284
1284
|
case -101:
|
|
1285
|
-
this.logger.error(
|
|
1286
|
-
await this.sendPrivateMsg(
|
|
1285
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发现账号还没登录呢,插件已经停止工作啦~请主人快点登录好让女仆继续努力呀 (>ω<)♡`);
|
|
1286
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发现账号还没登录呢,插件已经停止工作啦~请主人快点登录好让女仆继续努力呀 (>ω<)♡`);
|
|
1287
1287
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1288
1288
|
break;
|
|
1289
1289
|
case -352:
|
|
1290
|
-
this.logger.error("
|
|
1291
|
-
await this.sendPrivateMsg("
|
|
1290
|
+
this.logger.error("主人呜呜 (;>_<) 女仆发现账号被风控啦,插件已经停止工作~请主人输入指令 `bili cap` 并根据提示解除风控呀~女仆会乖乖等您完成的 (>ω<)♡");
|
|
1291
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆发现账号被风控啦,插件已经停止工作~请主人输入指令 `bili cap` 并根据提示解除风控呀~女仆会乖乖等您完成的 (>ω<)♡");
|
|
1292
1292
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1293
1293
|
break;
|
|
1294
1294
|
default:
|
|
1295
|
-
this.logger.error(
|
|
1296
|
-
await this.sendPrivateMsg(
|
|
1295
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件呀~女仆会乖乖等着的 (>ω<)♡`);
|
|
1296
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件呀~女仆会乖乖等着的 (>ω<)♡`);
|
|
1297
1297
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1298
1298
|
break;
|
|
1299
1299
|
}
|
|
1300
|
-
this.logger.info("
|
|
1300
|
+
this.logger.info("主人~女仆成功获取动态信息啦!正在乖乖开始处理动态信息呢 (>ω<)♡");
|
|
1301
1301
|
const items = content.data.items;
|
|
1302
1302
|
for (const item of items) {
|
|
1303
1303
|
if (!item) continue;
|
|
1304
1304
|
const postTime = item.modules.module_author.pub_ts;
|
|
1305
1305
|
const uid = item.modules.module_author.mid.toString();
|
|
1306
1306
|
const name$2 = item.modules.module_author.name;
|
|
1307
|
-
this.logger.info(
|
|
1307
|
+
this.logger.info(`主人主人~女仆已经成功拿到动态信息啦!UP主是:${name$2},UID:${uid},动态发布时间是:${luxon.DateTime.fromSeconds(postTime).toFormat("yyyy-MM-dd HH:mm:ss")} 哦~女仆超乖地汇报给您呢 (>ω<)♡`);
|
|
1308
1308
|
if (this.dynamicTimelineManager.has(uid)) {
|
|
1309
|
-
this.logger.info("
|
|
1309
|
+
this.logger.info("主人订阅订阅了这位UP主啦…女仆正在努力检查动态时间线呢 (>▽<)ゞ♡");
|
|
1310
1310
|
const timeline = this.dynamicTimelineManager.get(uid);
|
|
1311
|
-
this.logger.info(
|
|
1311
|
+
this.logger.info(`主人主人~女仆找到了上次的推送时间线哟:${luxon.DateTime.fromSeconds(timeline).toFormat("yyyy-MM-dd HH:mm:ss")} ~请您看看是不是对的呢 (〃・ω・〃)♡`);
|
|
1312
1312
|
if (timeline < postTime) {
|
|
1313
|
-
this.logger.info("
|
|
1313
|
+
this.logger.info("主人~这条动态需要推送哟!女仆已经开始乖乖进行推送啦 (๑•̀ω•́๑)✧♡");
|
|
1314
1314
|
const sub = this.subManager.get(uid);
|
|
1315
|
-
this.logger.info("
|
|
1315
|
+
this.logger.info("主人~女仆正在努力开始渲染推送卡片呢~请稍等一下呀 (〃ノωノ)♡");
|
|
1316
1316
|
const buffer = await withRetry(async () => {
|
|
1317
1317
|
return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
|
|
1318
1318
|
}, 1).catch(async (e) => {
|
|
@@ -1329,25 +1329,25 @@ var ComRegister = class ComRegister {
|
|
|
1329
1329
|
if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
|
|
1330
1330
|
return;
|
|
1331
1331
|
}
|
|
1332
|
-
this.logger.error(
|
|
1332
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect generateDynamicImg() 时推送卡片发送失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1333
1333
|
await this.sendPrivateMsgAndStopService();
|
|
1334
1334
|
});
|
|
1335
1335
|
if (!buffer) continue;
|
|
1336
|
-
this.logger.info("
|
|
1336
|
+
this.logger.info("主人~女仆渲染推送卡片成功啦!乖乖准备好发送啦 (>ω<)♡");
|
|
1337
1337
|
let dUrl = "";
|
|
1338
1338
|
if (this.config.dynamicUrl) {
|
|
1339
|
-
this.logger.info("
|
|
1339
|
+
this.logger.info("主人~女仆发现需要发送动态链接啦,正在努力生成链接中呢 (>ω<)♡");
|
|
1340
1340
|
if (item.type === "DYNAMIC_TYPE_AV") if (this.config.dynamicVideoUrlToBV) {
|
|
1341
1341
|
const bv = item.modules.module_dynamic.major.archive.jump_url.match(/BV[0-9A-Za-z]+/);
|
|
1342
1342
|
dUrl = bv ? bv[0] : "";
|
|
1343
1343
|
} else dUrl = `${name$2}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
|
|
1344
1344
|
else dUrl = `${name$2}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
|
|
1345
|
-
this.logger.info("
|
|
1345
|
+
this.logger.info("主人~女仆成功生成动态链接啦!准备好发送给大家啦 (>ω<)♡");
|
|
1346
1346
|
}
|
|
1347
|
-
this.logger.info("
|
|
1347
|
+
this.logger.info("主人~女仆正在推送动态中呢…请稍等哦 (>ω<)♡");
|
|
1348
1348
|
await this.broadcastToTargets(uid, (0, koishi.h)("message", [koishi.h.image(buffer, "image/jpeg"), koishi.h.text(dUrl)]), PushType.Dynamic);
|
|
1349
1349
|
if (this.config.pushImgsInDynamic) {
|
|
1350
|
-
this.logger.info("
|
|
1350
|
+
this.logger.info("主人~女仆发现动态里有图片要发送哦,正在努力发送中呢 (>ω<)♡");
|
|
1351
1351
|
if (item.type === "DYNAMIC_TYPE_DRAW") {
|
|
1352
1352
|
const pics = item.modules?.module_dynamic?.major?.opus?.pics;
|
|
1353
1353
|
if (pics) {
|
|
@@ -1355,20 +1355,20 @@ var ComRegister = class ComRegister {
|
|
|
1355
1355
|
await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
|
-
this.logger.info("
|
|
1358
|
+
this.logger.info("主人~女仆已经把动态中的图片发送完毕啦!乖乖完成任务啦 (>ω<)♡");
|
|
1359
1359
|
}
|
|
1360
1360
|
if (!currentPushDyn[uid]) currentPushDyn[uid] = item;
|
|
1361
|
-
this.logger.info("
|
|
1361
|
+
this.logger.info("主人~女仆的动态推送完毕啦!乖乖完成任务~(>ω<)♡");
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
1364
|
}
|
|
1365
|
-
this.logger.info("
|
|
1365
|
+
this.logger.info("主人~女仆已经把动态信息处理完毕啦!一切都乖乖完成啦 (>ω<)♡");
|
|
1366
1366
|
for (const uid in currentPushDyn) {
|
|
1367
1367
|
const postTime = currentPushDyn[uid].modules.module_author.pub_ts;
|
|
1368
1368
|
this.dynamicTimelineManager.set(uid, postTime);
|
|
1369
|
-
this.logger.info(
|
|
1369
|
+
this.logger.info(`主人~女仆成功更新了时间线啦!UP主:${uid},时间线:${luxon.DateTime.fromSeconds(postTime).toFormat("yyyy-MM-dd HH:mm:ss")} 哦~女仆超乖地汇报给您呢 (>ω<)♡`);
|
|
1370
1370
|
}
|
|
1371
|
-
this.logger.info(
|
|
1371
|
+
this.logger.info(`主人~女仆这次要推送的动态数量是:${Object.keys(currentPushDyn).length} 条哦~乖乖完成任务啦 (>ω<)♡`);
|
|
1372
1372
|
};
|
|
1373
1373
|
return withLock(handler);
|
|
1374
1374
|
}
|
|
@@ -1399,7 +1399,7 @@ var ComRegister = class ComRegister {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
async getLiveRoomInfo(roomId) {
|
|
1401
1401
|
const data = await withRetry(async () => await this.ctx["bilibili-notify-api"].getLiveRoomInfo(roomId)).then((content) => content.data).catch((e) => {
|
|
1402
|
-
this.logger.error(
|
|
1402
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 liveDetect getLiveRoomInfo 时遇到错误啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1403
1403
|
});
|
|
1404
1404
|
if (!data) {
|
|
1405
1405
|
await this.sendPrivateMsgAndStopService();
|
|
@@ -1411,7 +1411,7 @@ var ComRegister = class ComRegister {
|
|
|
1411
1411
|
const buffer = await withRetry(async () => {
|
|
1412
1412
|
return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface, liveData, liveType, liveInfo.cardStyle.enable ? liveInfo.cardStyle : void 0);
|
|
1413
1413
|
}, 1).catch((e) => {
|
|
1414
|
-
this.logger.error(
|
|
1414
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 liveDetect generateLiveImg() 时推送卡片生成失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1415
1415
|
});
|
|
1416
1416
|
if (!buffer) return await this.sendPrivateMsgAndStopService();
|
|
1417
1417
|
const msg = (0, koishi.h)("message", [koishi.h.image(buffer, "image/jpeg"), koishi.h.text(liveNotifyMsg || "")]);
|
|
@@ -1440,33 +1440,33 @@ var ComRegister = class ComRegister {
|
|
|
1440
1440
|
let masterInfo;
|
|
1441
1441
|
const liveData = { likedNum: "0" };
|
|
1442
1442
|
const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
|
|
1443
|
-
this.logger.info("
|
|
1444
|
-
this.logger.info("
|
|
1443
|
+
this.logger.info("主人~女仆正在开始制作弹幕词云呢~请稍等一下呀 (〃ノωノ)♡");
|
|
1444
|
+
this.logger.info("主人~女仆正在努力获取前90热词呢~请稍等哦 (>ω<)♡");
|
|
1445
1445
|
const words = Object.entries(danmakuWeightRecord);
|
|
1446
1446
|
const danmaker = Object.entries(danmakuSenderRecord);
|
|
1447
1447
|
const img = await (async () => {
|
|
1448
1448
|
if (words.length < 50) {
|
|
1449
|
-
this.logger.info("
|
|
1449
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现热词不足50个呢,本次弹幕词云只好放弃啦 (>ω<)♡");
|
|
1450
1450
|
return;
|
|
1451
1451
|
}
|
|
1452
1452
|
const top90Words = words.sort((a, b) => b[1] - a[1]).slice(0, 90);
|
|
1453
|
-
this.logger.info("
|
|
1453
|
+
this.logger.info("主人~女仆整理好了弹幕词云前90词及权重啦~请主人过目哦 (>ω<)♡");
|
|
1454
1454
|
this.logger.info(top90Words);
|
|
1455
|
-
this.logger.info("
|
|
1455
|
+
this.logger.info("主人~女仆正在准备生成弹幕词云呢~请稍等一下呀 (>ω<)♡");
|
|
1456
1456
|
const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
|
|
1457
1457
|
return koishi.h.image(buffer, "image/jpeg");
|
|
1458
1458
|
})();
|
|
1459
1459
|
const summary = await (async () => {
|
|
1460
1460
|
if (danmaker.length < 5) {
|
|
1461
|
-
this.logger.info("
|
|
1461
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现发言人数不足5位呢,本次弹幕词云只好放弃啦 (>ω<)♡");
|
|
1462
1462
|
return;
|
|
1463
1463
|
}
|
|
1464
|
-
this.logger.info("
|
|
1464
|
+
this.logger.info("主人~女仆正在开始构建弹幕发送排行榜消息呢~请稍等呀 (>ω<)♡");
|
|
1465
1465
|
const danmakuSenderCount = Object.keys(danmakuSenderRecord).length;
|
|
1466
1466
|
const danmakuCount = Object.values(danmakuSenderRecord).reduce((sum, val) => sum + val, 0);
|
|
1467
1467
|
const top5DanmakuSender = Object.entries(danmakuSenderRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
|
|
1468
1468
|
if (this.config.ai.enable) {
|
|
1469
|
-
this.logger.info("AI
|
|
1469
|
+
this.logger.info("主人~女仆发现 AI 直播总结功能已开启啦,正在努力生成 AI 直播总结呢 (>ω<)♡");
|
|
1470
1470
|
const top10Words = words.sort((a, b) => b[1] - a[1]).slice(0, 10);
|
|
1471
1471
|
const liveSummaryData = {
|
|
1472
1472
|
medalName: masterInfo.medalName,
|
|
@@ -1491,7 +1491,7 @@ var ComRegister = class ComRegister {
|
|
|
1491
1491
|
别以为发这么点弹幕就能糊弄过去,本兔可是盯着你们的!下次再偷懒小心被我踹飞!🐰🥕
|
|
1492
1492
|
|
|
1493
1493
|
以下是直播数据:${JSON.stringify(liveSummaryData)}`);
|
|
1494
|
-
this.logger.info("AI
|
|
1494
|
+
this.logger.info("主人~女仆生成好了 AI 直播总结啦,请主人过目哦 (>ω<)♡");
|
|
1495
1495
|
this.logger.info(res.choices[0].message.content);
|
|
1496
1496
|
return res.choices[0].message.content;
|
|
1497
1497
|
}
|
|
@@ -1507,13 +1507,13 @@ var ComRegister = class ComRegister {
|
|
|
1507
1507
|
};
|
|
1508
1508
|
const pushAtTimeFunc = async () => {
|
|
1509
1509
|
if (!await useLiveRoomInfo(LiveType.LiveBroadcast) && !await useMasterInfo(LiveType.LiveBroadcast)) {
|
|
1510
|
-
await this.sendPrivateMsg("
|
|
1510
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,推送直播卡片也失败了~请主人帮女仆看看呀 (>ω<)♡");
|
|
1511
1511
|
return await this.sendPrivateMsgAndStopService();
|
|
1512
1512
|
}
|
|
1513
1513
|
if (liveRoomInfo.live_status === 0 || liveRoomInfo.live_status === 2) {
|
|
1514
1514
|
liveStatus = false;
|
|
1515
1515
|
pushAtTimeTimer?.();
|
|
1516
|
-
await this.sendPrivateMsg("
|
|
1516
|
+
await this.sendPrivateMsg("主人~女仆发现直播间已下播啦!可能与直播间的连接断开了,请主人使用指令 `bn restart` 重启插件呀 (>ω<)♡");
|
|
1517
1517
|
return;
|
|
1518
1518
|
}
|
|
1519
1519
|
liveTime = liveRoomInfo.live_time;
|
|
@@ -1558,8 +1558,8 @@ var ComRegister = class ComRegister {
|
|
|
1558
1558
|
pushAtTimeTimer?.();
|
|
1559
1559
|
pushAtTimeTimer = null;
|
|
1560
1560
|
this.ctx["bilibili-notify-live"].closeListener(sub.roomid);
|
|
1561
|
-
await this.sendPrivateMsg(
|
|
1562
|
-
this.logger.error(
|
|
1561
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发现 [${sub.roomid}] 直播间连接发生错误啦,请主人帮女仆看看呀 (>ω<)♡`);
|
|
1562
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发现 [${sub.roomid}] 直播间连接发生错误啦,请主人帮女仆看看呀 (>ω<)♡`);
|
|
1563
1563
|
},
|
|
1564
1564
|
onIncomeDanmu: ({ body }) => {
|
|
1565
1565
|
this.segmentDanmaku(body.content, danmakuWeightRecord);
|
|
@@ -1612,21 +1612,21 @@ var ComRegister = class ComRegister {
|
|
|
1612
1612
|
onLiveStart: async () => {
|
|
1613
1613
|
const now = Date.now();
|
|
1614
1614
|
if (now - lastLiveStart < LIVE_EVENT_COOLDOWN) {
|
|
1615
|
-
this.logger.warn(
|
|
1615
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 的开播事件在冷却期内,所以被忽略啦 (>ω<)♡`);
|
|
1616
1616
|
return;
|
|
1617
1617
|
}
|
|
1618
1618
|
lastLiveStart = now;
|
|
1619
1619
|
if (liveStatus) {
|
|
1620
|
-
this.logger.warn(
|
|
1620
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 已经是开播状态啦,所以忽略了重复的开播事件哦 (>ω<)♡`);
|
|
1621
1621
|
return;
|
|
1622
1622
|
}
|
|
1623
1623
|
liveStatus = true;
|
|
1624
1624
|
if (!await useLiveRoomInfo(LiveType.StartBroadcasting) && !await useMasterInfo(LiveType.StartBroadcasting)) {
|
|
1625
1625
|
liveStatus = false;
|
|
1626
|
-
await this.sendPrivateMsg("
|
|
1626
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,推送直播开播卡片也失败了,请主人帮女仆看看呀 (>ω<)♡");
|
|
1627
1627
|
return await this.sendPrivateMsgAndStopService();
|
|
1628
1628
|
}
|
|
1629
|
-
this.logger.info(
|
|
1629
|
+
this.logger.info(`主人~女仆查到房间号是:${masterInfo.roomId},开播时的粉丝数有:${masterInfo.liveOpenFollowerNum} 哦~女仆乖乖汇报完毕 (>ω<)♡`);
|
|
1630
1630
|
liveTime = liveRoomInfo?.live_time || luxon.DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1631
1631
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1632
1632
|
const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
|
|
@@ -1645,21 +1645,21 @@ var ComRegister = class ComRegister {
|
|
|
1645
1645
|
onLiveEnd: async () => {
|
|
1646
1646
|
const now = Date.now();
|
|
1647
1647
|
if (now - lastLiveEnd < LIVE_EVENT_COOLDOWN) {
|
|
1648
|
-
this.logger.warn(
|
|
1648
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 的下播事件在冷却期内,所以被忽略啦 (>ω<)♡`);
|
|
1649
1649
|
return;
|
|
1650
1650
|
}
|
|
1651
1651
|
lastLiveEnd = now;
|
|
1652
1652
|
if (!liveStatus) {
|
|
1653
|
-
this.logger.warn(
|
|
1653
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 已经是下播状态啦,所以忽略了重复的下播事件哦 (>ω<)♡`);
|
|
1654
1654
|
return;
|
|
1655
1655
|
}
|
|
1656
1656
|
if (!await useLiveRoomInfo(LiveType.StopBroadcast) && !await useMasterInfo(LiveType.StopBroadcast)) {
|
|
1657
1657
|
liveStatus = false;
|
|
1658
|
-
await this.sendPrivateMsg("
|
|
1658
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,推送直播开播卡片也失败了,请主人帮女仆看看呀 (>ω<)♡");
|
|
1659
1659
|
return await this.sendPrivateMsgAndStopService();
|
|
1660
1660
|
}
|
|
1661
1661
|
liveStatus = false;
|
|
1662
|
-
this.logger.info(
|
|
1662
|
+
this.logger.info(`主人~女仆报告开播时粉丝数:${masterInfo.liveOpenFollowerNum},下播时粉丝数:${masterInfo.liveEndFollowerNum},粉丝数变化:${masterInfo.liveFollowerChange} 哦~女仆乖乖汇报完毕 (>ω<)♡`);
|
|
1663
1663
|
liveTime = liveRoomInfo?.live_time || luxon.DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1664
1664
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1665
1665
|
const followerChange = (() => {
|
|
@@ -1684,8 +1684,8 @@ var ComRegister = class ComRegister {
|
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
1686
1686
|
});
|
|
1687
|
-
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.sendPrivateMsg("
|
|
1688
|
-
this.logger.info(
|
|
1687
|
+
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,所以启动直播间弹幕检测也失败了,请主人帮女仆看看呀 (>ω<)♡");
|
|
1688
|
+
this.logger.info(`主人~女仆查到当前粉丝数是:${masterInfo.liveOpenFollowerNum} 哦~乖乖报告完毕 (>ω<)♡`);
|
|
1689
1689
|
if (liveRoomInfo.live_status === 1) {
|
|
1690
1690
|
liveTime = liveRoomInfo.live_time;
|
|
1691
1691
|
const watched = liveData.watchedNum || "暂未获取到";
|
|
@@ -1754,7 +1754,7 @@ var ComRegister = class ComRegister {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
return {
|
|
1756
1756
|
code: 0,
|
|
1757
|
-
message: "
|
|
1757
|
+
message: "主人~女仆发现这个分组已经存在啦 (>ω<)♡"
|
|
1758
1758
|
};
|
|
1759
1759
|
};
|
|
1760
1760
|
const resp = await checkGroupIsReady();
|
|
@@ -1776,7 +1776,7 @@ var ComRegister = class ComRegister {
|
|
|
1776
1776
|
}
|
|
1777
1777
|
return {
|
|
1778
1778
|
code: 0,
|
|
1779
|
-
message: "
|
|
1779
|
+
message: "主人~女仆获取分组明细成功啦~乖乖汇报完毕 (>ω<)♡",
|
|
1780
1780
|
data: relationGroupDetailData.data
|
|
1781
1781
|
};
|
|
1782
1782
|
};
|
|
@@ -1787,68 +1787,68 @@ var ComRegister = class ComRegister {
|
|
|
1787
1787
|
};
|
|
1788
1788
|
return {
|
|
1789
1789
|
code: 0,
|
|
1790
|
-
message: "
|
|
1790
|
+
message: "主人~女仆获取分组明细成功啦~乖乖汇报完毕 (>ω<)♡",
|
|
1791
1791
|
data
|
|
1792
1792
|
};
|
|
1793
1793
|
}
|
|
1794
1794
|
async subUserInBili(mid) {
|
|
1795
1795
|
for (const user of this.groupInfo) if (user.mid.toString() === mid) return {
|
|
1796
1796
|
code: 0,
|
|
1797
|
-
message: "
|
|
1797
|
+
message: "主人~女仆发现订阅对象已经在分组里啦 (>ω<)♡"
|
|
1798
1798
|
};
|
|
1799
1799
|
const subUserData = await this.ctx["bilibili-notify-api"].follow(mid);
|
|
1800
1800
|
return await ({
|
|
1801
1801
|
[-101]: () => {
|
|
1802
1802
|
return {
|
|
1803
1803
|
code: subUserData.code,
|
|
1804
|
-
message: "
|
|
1804
|
+
message: "主人呜呜 (;>_<) 女仆发现账号未登录哦~请主人使用指令 `bili login` 登录后再进行订阅操作呀 (>ω<)♡"
|
|
1805
1805
|
};
|
|
1806
1806
|
},
|
|
1807
1807
|
[-102]: () => {
|
|
1808
1808
|
return {
|
|
1809
1809
|
code: subUserData.code,
|
|
1810
|
-
message: "
|
|
1810
|
+
message: "主人呜呜 (;>_<) 女仆发现账号被封停啦,所以无法进行订阅操作呀 (>ω<)♡"
|
|
1811
1811
|
};
|
|
1812
1812
|
},
|
|
1813
1813
|
22002: () => {
|
|
1814
1814
|
return {
|
|
1815
1815
|
code: subUserData.code,
|
|
1816
|
-
message: "
|
|
1816
|
+
message: "主人呜呜 (;>_<) 女仆发现因为对方隐私设置,无法进行订阅操作呀 (>ω<)♡"
|
|
1817
1817
|
};
|
|
1818
1818
|
},
|
|
1819
1819
|
22003: () => {
|
|
1820
1820
|
return {
|
|
1821
1821
|
code: subUserData.code,
|
|
1822
|
-
message: "
|
|
1822
|
+
message: "主人呜呜 (;>_<) 女仆发现您已经把对方拉黑啦,所以无法进行订阅操作呀 (>ω<)♡"
|
|
1823
1823
|
};
|
|
1824
1824
|
},
|
|
1825
1825
|
22013: () => {
|
|
1826
1826
|
return {
|
|
1827
1827
|
code: subUserData.code,
|
|
1828
|
-
message: "
|
|
1828
|
+
message: "主人呜呜 (;>_<) 女仆发现账号已注销啦,所以无法进行订阅操作呀 (>ω<)♡"
|
|
1829
1829
|
};
|
|
1830
1830
|
},
|
|
1831
1831
|
40061: () => {
|
|
1832
1832
|
return {
|
|
1833
1833
|
code: subUserData.code,
|
|
1834
|
-
message: "
|
|
1834
|
+
message: "主人呜呜 (;>_<) 女仆发现账号不存在哦~请主人检查 UID 输入是否正确,或者用户是否真的存在呀 (>ω<)♡"
|
|
1835
1835
|
};
|
|
1836
1836
|
},
|
|
1837
1837
|
22001: () => {
|
|
1838
1838
|
return {
|
|
1839
1839
|
code: 0,
|
|
1840
|
-
message: "
|
|
1840
|
+
message: "主人~女仆发现订阅对象是主人自己呢~所以不用添加到分组啦 (>ω<)♡"
|
|
1841
1841
|
};
|
|
1842
1842
|
},
|
|
1843
1843
|
22014: async () => {
|
|
1844
1844
|
const copyUserToGroupData = await this.ctx["bilibili-notify-api"].copyUserToGroup(mid, this.loginDBData.dynamic_group_id);
|
|
1845
1845
|
if (copyUserToGroupData.code !== 0) return {
|
|
1846
1846
|
code: copyUserToGroupData.code,
|
|
1847
|
-
message: "
|
|
1847
|
+
message: "主人呜呜 (;>_<) 女仆尝试把订阅对象添加到分组失败啦~请主人稍后再试哦 (>ω<)♡"
|
|
1848
1848
|
};
|
|
1849
1849
|
return {
|
|
1850
1850
|
code: 0,
|
|
1851
|
-
message: "
|
|
1851
|
+
message: "主人~女仆已经成功把订阅对象添加到分组啦 (>ω<)♡"
|
|
1852
1852
|
};
|
|
1853
1853
|
},
|
|
1854
1854
|
22015: async () => {
|
|
@@ -1861,11 +1861,11 @@ var ComRegister = class ComRegister {
|
|
|
1861
1861
|
const copyUserToGroupData = await this.ctx["bilibili-notify-api"].copyUserToGroup(mid, this.loginDBData.dynamic_group_id);
|
|
1862
1862
|
if (copyUserToGroupData.code !== 0) return {
|
|
1863
1863
|
code: copyUserToGroupData.code,
|
|
1864
|
-
message: "
|
|
1864
|
+
message: "主人呜呜 (;>_<) 女仆尝试把订阅对象添加到分组失败啦~请主人稍后再试哦 (>ω<)♡"
|
|
1865
1865
|
};
|
|
1866
1866
|
return {
|
|
1867
1867
|
code: 0,
|
|
1868
|
-
message: "
|
|
1868
|
+
message: "主人~女仆已经成功把订阅对象添加到分组啦 (>ω<)♡"
|
|
1869
1869
|
};
|
|
1870
1870
|
}
|
|
1871
1871
|
}[subUserData.code] || (() => {
|
|
@@ -1878,10 +1878,10 @@ var ComRegister = class ComRegister {
|
|
|
1878
1878
|
async loadSubFromConfig(subs) {
|
|
1879
1879
|
this.preInitConfig(subs);
|
|
1880
1880
|
for (const sub of Object.values(subs)) {
|
|
1881
|
-
this.logger.info(
|
|
1881
|
+
this.logger.info(`主人~女仆正在加载订阅 UID:${sub.uid} 中呢~请稍等呀 (>ω<)♡`);
|
|
1882
1882
|
const subInfo = await this.subUserInBili(sub.uid);
|
|
1883
1883
|
if (subInfo.code !== 0 && subInfo.code !== 22015) return subInfo;
|
|
1884
|
-
if (subInfo.code === 22015) this.logger.warn(
|
|
1884
|
+
if (subInfo.code === 22015) this.logger.warn(`主人呜呜 (;>_<) 女仆发现账号异常,无法自动订阅 UID:${sub.uid} 哦~请主人手动订阅,然后把订阅移动到 "订阅" 分组里呀 (>ω<)♡`);
|
|
1885
1885
|
this.subManager.set(sub.uid, {
|
|
1886
1886
|
uname: sub.uname,
|
|
1887
1887
|
roomId: sub.roomid,
|
|
@@ -1893,19 +1893,19 @@ var ComRegister = class ComRegister {
|
|
|
1893
1893
|
customLiveSummary: sub.customLiveSummary
|
|
1894
1894
|
});
|
|
1895
1895
|
if (sub.live && !sub.roomid) {
|
|
1896
|
-
this.logger.info(
|
|
1896
|
+
this.logger.info(`主人~女仆发现 UID:${sub.uid} 请求了用户接口哦~女仆乖乖记录啦 (>ω<)♡`);
|
|
1897
1897
|
const { code: userInfoCode, message: userInfoMsg, data: userInfoData } = await withRetry(async () => {
|
|
1898
1898
|
return await this.ctx["bilibili-notify-api"].getUserInfo(sub.uid);
|
|
1899
1899
|
}).catch((e) => {
|
|
1900
|
-
this.logger.error(
|
|
1900
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 loadSubFromConfig() 的 getUserInfo() 时发生错误啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1901
1901
|
return {
|
|
1902
1902
|
code: -1,
|
|
1903
|
-
message:
|
|
1903
|
+
message: `主人呜呜 (;>_<) 女仆加载订阅 UID:${sub.uid} 失败啦~请主人帮女仆看看呀 (>ω<)♡`
|
|
1904
1904
|
};
|
|
1905
1905
|
});
|
|
1906
1906
|
if (userInfoCode === -352 && userInfoData.v_voucher) {
|
|
1907
|
-
this.logger.info("
|
|
1908
|
-
await this.sendPrivateMsg("
|
|
1907
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现账号被风控啦~请主人使用指令 `bili cap` 进行风控验证呀 (>ω<)♡");
|
|
1908
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆发现账号被风控啦~请主人使用指令 `bili cap` 进行风控验证呀 (>ω<)♡");
|
|
1909
1909
|
return {
|
|
1910
1910
|
code: userInfoCode,
|
|
1911
1911
|
message: userInfoMsg
|
|
@@ -1917,21 +1917,21 @@ var ComRegister = class ComRegister {
|
|
|
1917
1917
|
};
|
|
1918
1918
|
if (sub.live && !userInfoData.live_room) {
|
|
1919
1919
|
sub.live = false;
|
|
1920
|
-
this.logger.warn(
|
|
1920
|
+
this.logger.warn(`主人~女仆发现 UID:${sub.uid} 的用户没有开通直播间哦,所以无法订阅直播啦 (>ω<)♡`);
|
|
1921
1921
|
}
|
|
1922
1922
|
sub.roomid = userInfoData.live_room?.roomid;
|
|
1923
1923
|
}
|
|
1924
1924
|
if (sub.live && sub.roomid) await this.liveDetectWithListener(sub);
|
|
1925
|
-
this.logger.info(
|
|
1925
|
+
this.logger.info(`主人~女仆订阅 UID:${sub.uid} 已经加载完毕啦~乖乖完成任务啦 (>ω<)♡`);
|
|
1926
1926
|
if (sub !== Object.values(subs).pop()) {
|
|
1927
1927
|
const randomDelay = Math.floor(Math.random() * 3) + 1;
|
|
1928
|
-
this.logger.info(
|
|
1928
|
+
this.logger.info(`主人~女仆设置了随机延迟哦~延迟时间:${randomDelay} 秒呢 (>ω<)♡`);
|
|
1929
1929
|
await this.ctx.sleep(randomDelay * 1e3);
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
1932
|
return {
|
|
1933
1933
|
code: 0,
|
|
1934
|
-
message: "
|
|
1934
|
+
message: "主人~女仆的订阅加载完毕啦!乖乖完成任务~(>ω<)♡"
|
|
1935
1935
|
};
|
|
1936
1936
|
}
|
|
1937
1937
|
checkIfDynamicDetectIsNeeded() {
|
|
@@ -1939,7 +1939,7 @@ var ComRegister = class ComRegister {
|
|
|
1939
1939
|
}
|
|
1940
1940
|
enableDynamicDetect() {
|
|
1941
1941
|
this.dynamicJob = new cron.CronJob(this.config.dynamicCron, this.config.dynamicDebugMode ? this.debug_dynamicDetect() : this.dynamicDetect());
|
|
1942
|
-
this.logger.info("
|
|
1942
|
+
this.logger.info("主人~女仆的动态监测已经开启啦~开始乖乖监控动态呢 (>ω<)♡");
|
|
1943
1943
|
this.dynamicJob.start();
|
|
1944
1944
|
}
|
|
1945
1945
|
async checkIfIsLogin() {
|
|
@@ -3822,7 +3822,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3822
3822
|
this.wbiSign.img_key = ticket.data.nav.img.slice(ticket.data.nav.img.lastIndexOf("/") + 1, ticket.data.nav.img.lastIndexOf("."));
|
|
3823
3823
|
this.wbiSign.sub_key = ticket.data.nav.sub.slice(ticket.data.nav.sub.lastIndexOf("/") + 1, ticket.data.nav.sub.lastIndexOf("."));
|
|
3824
3824
|
} catch (e) {
|
|
3825
|
-
this.logger.error(
|
|
3825
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆更新 BiliTicket 失败啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3826
3826
|
}
|
|
3827
3827
|
}
|
|
3828
3828
|
getMixinKey = (orig) => mixinKeyEncTab.map((n) => orig[n]).join("").slice(0, 32);
|
|
@@ -3863,7 +3863,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3863
3863
|
};
|
|
3864
3864
|
return await this.pRetry(run, {
|
|
3865
3865
|
onFailedAttempt: (error) => {
|
|
3866
|
-
this.logger.error(
|
|
3866
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTheUserWhoIsLiveStreaming() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3867
3867
|
},
|
|
3868
3868
|
retries: 3
|
|
3869
3869
|
});
|
|
@@ -3875,7 +3875,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3875
3875
|
};
|
|
3876
3876
|
return await this.pRetry(run, {
|
|
3877
3877
|
onFailedAttempt: (error) => {
|
|
3878
|
-
this.logger.error(
|
|
3878
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoStreamKey() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3879
3879
|
},
|
|
3880
3880
|
retries: 3
|
|
3881
3881
|
});
|
|
@@ -3888,7 +3888,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3888
3888
|
};
|
|
3889
3889
|
return await this.pRetry(run, {
|
|
3890
3890
|
onFailedAttempt: (error) => {
|
|
3891
|
-
this.logger.error(
|
|
3891
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoByUids() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3892
3892
|
},
|
|
3893
3893
|
retries: 3
|
|
3894
3894
|
});
|
|
@@ -3902,7 +3902,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3902
3902
|
};
|
|
3903
3903
|
return await this.pRetry(run, {
|
|
3904
3904
|
onFailedAttempt: (error) => {
|
|
3905
|
-
this.logger.error(
|
|
3905
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getServerUTCTime() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3906
3906
|
},
|
|
3907
3907
|
retries: 3
|
|
3908
3908
|
});
|
|
@@ -3914,7 +3914,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3914
3914
|
};
|
|
3915
3915
|
return await this.pRetry(run, {
|
|
3916
3916
|
onFailedAttempt: (error) => {
|
|
3917
|
-
this.logger.error(
|
|
3917
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTimeNow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3918
3918
|
},
|
|
3919
3919
|
retries: 3
|
|
3920
3920
|
});
|
|
@@ -3926,7 +3926,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3926
3926
|
};
|
|
3927
3927
|
return await this.pRetry(run, {
|
|
3928
3928
|
onFailedAttempt: (error) => {
|
|
3929
|
-
this.logger.error(
|
|
3929
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3930
3930
|
},
|
|
3931
3931
|
retries: 3
|
|
3932
3932
|
});
|
|
@@ -3943,7 +3943,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3943
3943
|
};
|
|
3944
3944
|
return await this.pRetry(run, {
|
|
3945
3945
|
onFailedAttempt: (error) => {
|
|
3946
|
-
this.logger.error(
|
|
3946
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 removeUserFromGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3947
3947
|
},
|
|
3948
3948
|
retries: 3
|
|
3949
3949
|
});
|
|
@@ -3960,7 +3960,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3960
3960
|
};
|
|
3961
3961
|
return await this.pRetry(run, {
|
|
3962
3962
|
onFailedAttempt: (error) => {
|
|
3963
|
-
this.logger.error(
|
|
3963
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 copyUserToGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3964
3964
|
},
|
|
3965
3965
|
retries: 3
|
|
3966
3966
|
});
|
|
@@ -3972,7 +3972,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3972
3972
|
};
|
|
3973
3973
|
return await this.pRetry(run, {
|
|
3974
3974
|
onFailedAttempt: (error) => {
|
|
3975
|
-
this.logger.error(
|
|
3975
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserSpaceDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3976
3976
|
},
|
|
3977
3977
|
retries: 3
|
|
3978
3978
|
});
|
|
@@ -3987,7 +3987,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3987
3987
|
};
|
|
3988
3988
|
return await this.pRetry(run, {
|
|
3989
3989
|
onFailedAttempt: (error) => {
|
|
3990
|
-
this.logger.error(
|
|
3990
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 createGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3991
3991
|
},
|
|
3992
3992
|
retries: 3
|
|
3993
3993
|
});
|
|
@@ -3999,7 +3999,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3999
3999
|
};
|
|
4000
4000
|
return await this.pRetry(run, {
|
|
4001
4001
|
onFailedAttempt: (error) => {
|
|
4002
|
-
this.logger.error(
|
|
4002
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4003
4003
|
},
|
|
4004
4004
|
retries: 3
|
|
4005
4005
|
});
|
|
@@ -4011,7 +4011,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4011
4011
|
};
|
|
4012
4012
|
return await this.pRetry(run, {
|
|
4013
4013
|
onFailedAttempt: (error) => {
|
|
4014
|
-
this.logger.error(
|
|
4014
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 hasNewDynamic()时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4015
4015
|
},
|
|
4016
4016
|
retries: 3
|
|
4017
4017
|
});
|
|
@@ -4028,7 +4028,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4028
4028
|
};
|
|
4029
4029
|
return await this.pRetry(run, {
|
|
4030
4030
|
onFailedAttempt: (error) => {
|
|
4031
|
-
this.logger.error(
|
|
4031
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 follow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4032
4032
|
},
|
|
4033
4033
|
retries: 3
|
|
4034
4034
|
});
|
|
@@ -4040,7 +4040,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4040
4040
|
};
|
|
4041
4041
|
return await this.pRetry(run, {
|
|
4042
4042
|
onFailedAttempt: (error) => {
|
|
4043
|
-
this.logger.error(
|
|
4043
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getRelationGroupDetail() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4044
4044
|
},
|
|
4045
4045
|
retries: 3
|
|
4046
4046
|
});
|
|
@@ -4055,7 +4055,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4055
4055
|
};
|
|
4056
4056
|
return await this.pRetry(run, {
|
|
4057
4057
|
onFailedAttempt: (error) => {
|
|
4058
|
-
this.logger.error(
|
|
4058
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getCookieInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4059
4059
|
},
|
|
4060
4060
|
retries: 3
|
|
4061
4061
|
});
|
|
@@ -4074,7 +4074,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4074
4074
|
};
|
|
4075
4075
|
return await this.pRetry(run, {
|
|
4076
4076
|
onFailedAttempt: (error) => {
|
|
4077
|
-
this.logger.error(
|
|
4077
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4078
4078
|
},
|
|
4079
4079
|
retries: 3
|
|
4080
4080
|
});
|
|
@@ -4090,7 +4090,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4090
4090
|
};
|
|
4091
4091
|
return await this.pRetry(run, {
|
|
4092
4092
|
onFailedAttempt: (error) => {
|
|
4093
|
-
this.logger.error(
|
|
4093
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getWbiKeys() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4094
4094
|
},
|
|
4095
4095
|
retries: 3
|
|
4096
4096
|
});
|
|
@@ -4102,7 +4102,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4102
4102
|
};
|
|
4103
4103
|
return await this.pRetry(run, {
|
|
4104
4104
|
onFailedAttempt: (error) => {
|
|
4105
|
-
this.logger.error(
|
|
4105
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMyselfInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4106
4106
|
},
|
|
4107
4107
|
retries: 3
|
|
4108
4108
|
});
|
|
@@ -4114,7 +4114,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4114
4114
|
};
|
|
4115
4115
|
return await this.pRetry(run, {
|
|
4116
4116
|
onFailedAttempt: (error) => {
|
|
4117
|
-
this.logger.error(
|
|
4117
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginQRCode() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4118
4118
|
},
|
|
4119
4119
|
retries: 3
|
|
4120
4120
|
});
|
|
@@ -4126,7 +4126,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4126
4126
|
};
|
|
4127
4127
|
return await this.pRetry(run, {
|
|
4128
4128
|
onFailedAttempt: (error) => {
|
|
4129
|
-
this.logger.error(
|
|
4129
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginStatus() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4130
4130
|
},
|
|
4131
4131
|
retries: 3
|
|
4132
4132
|
});
|
|
@@ -4138,7 +4138,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4138
4138
|
};
|
|
4139
4139
|
return await this.pRetry(run, {
|
|
4140
4140
|
onFailedAttempt: (error) => {
|
|
4141
|
-
this.logger.error(
|
|
4141
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4142
4142
|
},
|
|
4143
4143
|
retries: 3
|
|
4144
4144
|
});
|
|
@@ -4150,7 +4150,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4150
4150
|
};
|
|
4151
4151
|
return await this.pRetry(run, {
|
|
4152
4152
|
onFailedAttempt: (error) => {
|
|
4153
|
-
this.logger.error(
|
|
4153
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMasterInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4154
4154
|
},
|
|
4155
4155
|
retries: 3
|
|
4156
4156
|
});
|
|
@@ -4162,7 +4162,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4162
4162
|
};
|
|
4163
4163
|
return await this.pRetry(run, {
|
|
4164
4164
|
onFailedAttempt: (error) => {
|
|
4165
|
-
this.logger.error(
|
|
4165
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getOnlineGoldRank() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4166
4166
|
},
|
|
4167
4167
|
retries: 3
|
|
4168
4168
|
});
|
|
@@ -4174,7 +4174,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4174
4174
|
};
|
|
4175
4175
|
return await this.pRetry(run, {
|
|
4176
4176
|
onFailedAttempt: (error) => {
|
|
4177
|
-
this.logger.error(
|
|
4177
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4178
4178
|
},
|
|
4179
4179
|
retries: 3
|
|
4180
4180
|
});
|
|
@@ -4188,7 +4188,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4188
4188
|
};
|
|
4189
4189
|
return await this.pRetry(run, {
|
|
4190
4190
|
onFailedAttempt: (error) => {
|
|
4191
|
-
this.logger.error(
|
|
4191
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4192
4192
|
},
|
|
4193
4193
|
retries: 3
|
|
4194
4194
|
});
|
|
@@ -4200,7 +4200,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4200
4200
|
};
|
|
4201
4201
|
return await this.pRetry(run, {
|
|
4202
4202
|
onFailedAttempt: (error) => {
|
|
4203
|
-
this.logger.error(
|
|
4203
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4204
4204
|
},
|
|
4205
4205
|
retries: 3
|
|
4206
4206
|
});
|
|
@@ -4277,7 +4277,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4277
4277
|
baseURL: this.apiConfig.ai.baseURL,
|
|
4278
4278
|
apiKey: this.apiConfig.ai.apiKey
|
|
4279
4279
|
});
|
|
4280
|
-
this.logger.info("AI
|
|
4280
|
+
this.logger.info("主人~女仆的 AI 客户端创建成功啦~乖乖准备好为主人服务呢 (>ω<)♡");
|
|
4281
4281
|
}
|
|
4282
4282
|
}
|
|
4283
4283
|
addCookie(cookieStr) {
|
|
@@ -4484,7 +4484,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4484
4484
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } }).catch((e) => {
|
|
4485
4485
|
this.logger.error(e);
|
|
4486
4486
|
});
|
|
4487
|
-
if (data.code !== 0) this.logger.error("
|
|
4487
|
+
if (data.code !== 0) this.logger.error("主人呜呜 (;>_<) 女仆获取验证码失败啦,请主人再试一次呀 (>ω<)♡");
|
|
4488
4488
|
return { data: data.data };
|
|
4489
4489
|
}
|
|
4490
4490
|
async validateCaptcha(challenge, token, validate, seccode) {
|
|
@@ -4497,7 +4497,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4497
4497
|
seccode
|
|
4498
4498
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
4499
4499
|
if (data.code !== 0) {
|
|
4500
|
-
this.logger.info(
|
|
4500
|
+
this.logger.info(`主人呜呜 (;>_<) 验证失败啦~错误码=${data.code},错误消息:${data.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4501
4501
|
return { data: null };
|
|
4502
4502
|
}
|
|
4503
4503
|
this.addCookie(`x-bili-gaia-vtoken=${data.data.grisk_id}`);
|
|
@@ -4532,26 +4532,26 @@ var BLive = class extends koishi.Service {
|
|
|
4532
4532
|
}
|
|
4533
4533
|
async startLiveRoomListener(roomId, handler) {
|
|
4534
4534
|
if (this.listenerRecord[roomId]) {
|
|
4535
|
-
this.logger.warn(
|
|
4535
|
+
this.logger.warn(`主人~女仆发现 [${roomId}] 直播间连接已经存在啦,不能重复创建哦 (>ω<)♡`);
|
|
4536
4536
|
return;
|
|
4537
4537
|
}
|
|
4538
4538
|
const cookiesStr = await this.ctx["bilibili-notify-api"].getCookiesForHeader();
|
|
4539
4539
|
const mySelfInfo = await this.ctx["bilibili-notify-api"].getMyselfInfo();
|
|
4540
|
-
this.listenerRecord[roomId] = (0, blive_message_listener.startListen)(Number.parseInt(roomId), handler, { ws: {
|
|
4540
|
+
this.listenerRecord[roomId] = (0, blive_message_listener.startListen)(Number.parseInt(roomId, 10), handler, { ws: {
|
|
4541
4541
|
headers: { Cookie: cookiesStr },
|
|
4542
4542
|
uid: mySelfInfo.data.mid
|
|
4543
4543
|
} });
|
|
4544
|
-
this.logger.info(
|
|
4544
|
+
this.logger.info(`主人~女仆成功建立了 [${roomId}] 直播间连接啦~乖乖完成任务呢 (>ω<)♡`);
|
|
4545
4545
|
}
|
|
4546
4546
|
closeListener(roomId) {
|
|
4547
|
-
if (!this.listenerRecord || !this.listenerRecord[roomId]?.closed) this.logger.info(
|
|
4547
|
+
if (!this.listenerRecord || !this.listenerRecord[roomId]?.closed) this.logger.info(`主人~女仆发现 ${roomId} 直播间连接不需要关闭哦 (>ω<)♡`);
|
|
4548
4548
|
this.listenerRecord[roomId].close();
|
|
4549
4549
|
if (this.listenerRecord[roomId].closed) {
|
|
4550
4550
|
delete this.listenerRecord[roomId];
|
|
4551
|
-
this.logger.info(
|
|
4551
|
+
this.logger.info(`主人~女仆已经关闭了 ${roomId} 直播间连接啦 (>ω<)♡`);
|
|
4552
4552
|
return;
|
|
4553
4553
|
}
|
|
4554
|
-
this.logger.warn(
|
|
4554
|
+
this.logger.warn(`主人呜呜 (;>_<) 女仆尝试关闭 ${roomId} 直播间连接失败啦~请主人帮女仆看看呀 (>ω<)♡`);
|
|
4555
4555
|
}
|
|
4556
4556
|
clearListeners() {
|
|
4557
4557
|
for (const key of Object.keys(this.listenerRecord)) {
|
|
@@ -4577,14 +4577,25 @@ const usage = `
|
|
|
4577
4577
|
|
|
4578
4578
|
---
|
|
4579
4579
|
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4580
|
+
主人好呀~我是笨笨女仆小助手哒 (〃∀〃)♡
|
|
4581
|
+
专门帮主人管理 B 站订阅和直播推送的!
|
|
4582
|
+
女仆虽然笨笨的,但是会尽力不出错哦~
|
|
4583
|
+
主人,只要按照女仆的提示一步一步设置,女仆就可以乖乖帮您工作啦!
|
|
4584
|
+
|
|
4585
|
+
首先呢~请主人仔细阅读订阅相关的 subs 的填写说明 (>ω<)b
|
|
4586
|
+
【主人账号部分非必填】然后再告诉女仆您的 主人账号 (///▽///),并选择您希望女仆服务的平台~
|
|
4587
|
+
接着,请认真填写 主人的 ID 和 群组 ID,确保信息完全正确~
|
|
4588
|
+
这样女仆才能顺利找到您并准确汇报动态呢 (≧▽≦)
|
|
4589
|
+
|
|
4590
|
+
不用着急,女仆会一直在这里陪着您,一步一步完成设置~
|
|
4591
|
+
主人只要乖乖填好这些信息,就能让女仆变得超级听话、超级勤快啦 (>///<)♡
|
|
4592
|
+
|
|
4593
|
+
主人~注意事项要仔细看呀 (>_<)♡
|
|
4594
|
+
- 如果主人使用的是 onebot 机器人,平台名请填写 onebot,而不是 qq 哦~
|
|
4595
|
+
- 同样的呀,如果是 onebot 机器人,请务必填写 onebot,不要写成 qq 哦~
|
|
4596
|
+
- 女仆再提醒一次~onebot 机器人就填 onebot,千万不要写 qq 哦~
|
|
4583
4597
|
|
|
4584
|
-
|
|
4585
|
-
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4586
|
-
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4587
|
-
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4598
|
+
乖乖遵守这些规则,女仆才能顺利帮主人工作呢 (*>ω<)b
|
|
4588
4599
|
|
|
4589
4600
|
---
|
|
4590
4601
|
`;
|
|
@@ -4595,23 +4606,20 @@ var ServerManager = class extends koishi.Service {
|
|
|
4595
4606
|
super(ctx, "bilibili-notify");
|
|
4596
4607
|
const sysCom = ctx.command("bn", "bilibili-notify 插件运行相关指令", { permissions: ["authority:5"] });
|
|
4597
4608
|
sysCom.subcommand(".restart", "重启插件").usage("重启插件").example("bn restart").action(async () => {
|
|
4598
|
-
this.
|
|
4599
|
-
|
|
4600
|
-
return "插件重启失败";
|
|
4609
|
+
if (await this.restartPlugin()) return "主人~女仆成功重启插件啦~乖乖继续为主人服务呢 (>ω<)♡";
|
|
4610
|
+
return "主人呜呜 (;>_<) 女仆重启插件失败啦~请主人检查一下再试哦 (>ω<)♡";
|
|
4601
4611
|
});
|
|
4602
4612
|
sysCom.subcommand(".stop", "停止插件").usage("停止插件").example("bn stop").action(async () => {
|
|
4603
|
-
this.
|
|
4604
|
-
|
|
4605
|
-
return "停止插件失败";
|
|
4613
|
+
if (await this.disposePlugin()) return "主人~女仆已经停止插件啦~休息一下先 (>ω<)♡";
|
|
4614
|
+
return "主人呜呜 (;>_<) 女仆停止插件失败啦~请主人检查一下再试哦 (>ω<)♡";
|
|
4606
4615
|
});
|
|
4607
4616
|
sysCom.subcommand(".start", "启动插件").usage("启动插件").example("bn start").action(async () => {
|
|
4608
|
-
this.
|
|
4609
|
-
|
|
4610
|
-
return "插件启动失败";
|
|
4617
|
+
if (await this.registerPlugin()) return "主人~女仆成功启动插件啦~准备好乖乖为主人工作呢 (>ω<)♡";
|
|
4618
|
+
return "主人呜呜 (;>_<) 女仆启动插件失败啦~请主人检查一下再试哦 (>ω<)♡";
|
|
4611
4619
|
});
|
|
4612
4620
|
}
|
|
4613
4621
|
start() {
|
|
4614
|
-
if (!this.registerPlugin()) this.logger.error("
|
|
4622
|
+
if (!this.registerPlugin()) this.logger.error("主人呜呜 (;>_<) 女仆启动插件失败啦~请主人检查一下再试哦 (>ω<)♡");
|
|
4615
4623
|
}
|
|
4616
4624
|
registerPlugin = () => {
|
|
4617
4625
|
if (this.servers.length !== 0) return false;
|
|
@@ -4659,7 +4667,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4659
4667
|
this.servers.push(gi);
|
|
4660
4668
|
this.servers.push(cr);
|
|
4661
4669
|
} catch (e) {
|
|
4662
|
-
this.logger.error(
|
|
4670
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆注册插件失败啦~错误信息:${e},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4663
4671
|
return false;
|
|
4664
4672
|
}
|
|
4665
4673
|
return true;
|
|
@@ -4675,7 +4683,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4675
4683
|
};
|
|
4676
4684
|
restartPlugin = async () => {
|
|
4677
4685
|
if (this.servers.length === 0) {
|
|
4678
|
-
this.logger.warn("
|
|
4686
|
+
this.logger.warn("主人~女仆发现插件目前没有运行哦~请主人使用指令 bn start 启动插件呀 (>ω<)♡");
|
|
4679
4687
|
return false;
|
|
4680
4688
|
}
|
|
4681
4689
|
await this.disposePlugin();
|
|
@@ -4684,7 +4692,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4684
4692
|
try {
|
|
4685
4693
|
this.registerPlugin();
|
|
4686
4694
|
} catch (e) {
|
|
4687
|
-
this.logger.error(
|
|
4695
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆重启插件失败啦~错误信息:${e},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4688
4696
|
resolve$2(false);
|
|
4689
4697
|
}
|
|
4690
4698
|
resolve$2(true);
|