koishi-plugin-bilibili-notify 3.6.0-alpha.3 → 3.6.0
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 +370 -346
- package/lib/index.d.cts +12 -12
- package/lib/index.d.mts +12 -12
- package/lib/index.mjs +370 -346
- 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();
|
|
@@ -503,27 +503,36 @@ var ComRegister = class ComRegister {
|
|
|
503
503
|
});
|
|
504
504
|
biliCom.subcommand(".dyn <uid:string> [index:number]", "手动推送一条动态信息", { hidden: true }).usage("手动推送一条动态信息").example("bili dyn 233 1 手动推送UID为233用户空间的第一条动态信息").action(async ({ session }, uid, index) => {
|
|
505
505
|
const i = index && index - 1 || 0;
|
|
506
|
-
const
|
|
506
|
+
const content = await this.ctx["bilibili-notify-api"].getUserSpaceDynamic(uid);
|
|
507
|
+
if (!content || !content.data) {
|
|
508
|
+
this.logger.error("主人呜呜 (;>_<) 女仆获取动态内容失败啦~请主人帮女仆看看呀 (>ω<)♡");
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (content.code !== 0) {
|
|
512
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆获取动态内容失败啦~请主人帮女仆看看呀 (>ω<)♡ 错误码: ${content.code}`);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const item = content.data.items[i];
|
|
507
516
|
const buffer = await withRetry(async () => {
|
|
508
517
|
return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item);
|
|
509
518
|
}, 1).catch(async (e) => {
|
|
510
519
|
if (e.message === "直播开播动态,不做处理") {
|
|
511
|
-
await session.send("
|
|
520
|
+
await session.send("主人~女仆发现直播开播动态啦,但女仆不处理哦 (>ω<)♡");
|
|
512
521
|
return;
|
|
513
522
|
}
|
|
514
523
|
if (e.message === "出现关键词,屏蔽该动态") {
|
|
515
|
-
await session.send("
|
|
524
|
+
await session.send("主人~女仆已经屏蔽了这条动态啦 (>ω<)♡");
|
|
516
525
|
return;
|
|
517
526
|
}
|
|
518
527
|
if (e.message === "已屏蔽转发动态") {
|
|
519
|
-
await session.send("
|
|
528
|
+
await session.send("主人~女仆已经屏蔽了这条转发动态啦 (>ω<)♡");
|
|
520
529
|
return;
|
|
521
530
|
}
|
|
522
531
|
if (e.message === "已屏蔽专栏动态") {
|
|
523
|
-
await session.send("
|
|
532
|
+
await session.send("主人~女仆已经屏蔽了这条专栏动态啦 (>ω<)♡");
|
|
524
533
|
return;
|
|
525
534
|
}
|
|
526
|
-
this.logger.error(
|
|
535
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect generateDynamicImg() 时推送卡片发送失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
527
536
|
});
|
|
528
537
|
buffer && await session.send(koishi.h.image(buffer, "image/jpeg"));
|
|
529
538
|
});
|
|
@@ -637,22 +646,22 @@ var ComRegister = class ComRegister {
|
|
|
637
646
|
data: await this.ctx["bilibili-notify-api"].getUserInfo("114514")
|
|
638
647
|
};
|
|
639
648
|
}).then((content) => content.data);
|
|
640
|
-
if (userInfoCode !== -352 || !userInfoData.v_voucher) return "
|
|
649
|
+
if (userInfoCode !== -352 || !userInfoData.v_voucher) return "主人~女仆发现不满足验证条件呢~所以这个命令不用执行哦 (>ω<)♡ 如果提示风控,主人可以尝试重启插件看看呀 (*>ω<)b";
|
|
641
650
|
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("
|
|
651
|
+
if (!data.geetest) return "主人呜呜 (;>_<) 女仆发现当前风控无法通过验证解除哦~主人可能需要考虑人工申诉呢 (>ω<)♡";
|
|
652
|
+
await session.send("主人~请到这个网站进行验证操作哦~乖乖跟着做,女仆也会帮主人关注进度呢 (〃>ω<〃) https://kuresaru.github.io/geetest-validator/");
|
|
653
|
+
await session.send("主人~请手动填入 gt 和 challenge,然后点击生成进行验证哦~验证完成后再点击结果,并根据提示输入对应的 validate,女仆会在一旁乖乖等主人完成呢 (>ω<)♡");
|
|
645
654
|
await session.send(`gt:${data.geetest.gt}`);
|
|
646
655
|
await session.send(`challenge:${data.geetest.challenge}`);
|
|
647
|
-
await session.send("
|
|
656
|
+
await session.send("主人~验证完成啦~请直接输入 validate 告诉女仆哦 (>ω<)♡");
|
|
648
657
|
const validate = await session.prompt();
|
|
649
658
|
const seccode = `${validate}|jordan`;
|
|
650
659
|
const { data: validateCaptchaData } = await ctx["bilibili-notify-api"].validateCaptcha(data.geetest.challenge, data.token, validate, seccode);
|
|
651
|
-
if (validateCaptchaData?.is_valid !== 1) return "
|
|
660
|
+
if (validateCaptchaData?.is_valid !== 1) return "主人呜呜 (;>_<) 验证没有成功呢~请主人再试一次呀 (>ω<)♡";
|
|
652
661
|
await this.ctx.sleep(10 * 1e3);
|
|
653
662
|
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("
|
|
663
|
+
if (validCode === -352 && validData.v_voucher) return "主人呜呜 (;>_<) 验证没有成功呢~请主人再试一次呀 (>ω<)♡";
|
|
664
|
+
await session.send("主人~验证成功啦!请主人重启插件,女仆会乖乖继续工作哦 (>ω<)♡");
|
|
656
665
|
});
|
|
657
666
|
biliCom.subcommand(".ai").action(async () => {
|
|
658
667
|
this.logger.info("开始生成AI直播总结");
|
|
@@ -714,21 +723,21 @@ var ComRegister = class ComRegister {
|
|
|
714
723
|
}
|
|
715
724
|
async init(config) {
|
|
716
725
|
this.logger = this.ctx.logger("bilibili-notify-core");
|
|
717
|
-
this.logger.info("
|
|
726
|
+
this.logger.info("主人~女仆正在努力初始化插件中呢…请稍等一下哦 (>///<)♡");
|
|
718
727
|
this.config = config;
|
|
719
728
|
this.registeringForEvents();
|
|
720
729
|
this.privateBot = this.ctx.bots.find((bot) => bot.platform === config.master.platform);
|
|
721
|
-
if (!this.privateBot) this.ctx.notifier.create({ content: "
|
|
730
|
+
if (!this.privateBot) this.ctx.notifier.create({ content: "主人呜呜 (;>_<) 您还没有配置主人账号呢~女仆没办法向您推送插件运行状态啦,请快点配置哦 (>ω<)♡" });
|
|
722
731
|
this.loginDBData = (await this.ctx.database.get("loginBili", 1, ["dynamic_group_id"]))[0];
|
|
723
732
|
await this.checkIfLoginInfoIsLoaded();
|
|
724
733
|
if (!await this.checkIfIsLogin()) {
|
|
725
|
-
this.logger.info("
|
|
734
|
+
this.logger.info("主人…呜呜 (;>_<) 女仆发现账号还没登录呢,请主人快点登录好让女仆继续工作呀 (>ω<)♡");
|
|
726
735
|
return;
|
|
727
736
|
}
|
|
728
737
|
const personalInfo = await this.ctx["bilibili-notify-api"].getMyselfInfo();
|
|
729
738
|
if (personalInfo.code !== 0) this.ctx.emit("bilibili-notify/login-status-report", {
|
|
730
739
|
status: BiliLoginStatus.LOGGED_IN,
|
|
731
|
-
msg: "
|
|
740
|
+
msg: "主人…呜呜 (;>_<) 虽然账号已登录,但女仆获取个人信息失败啦,请主人检查一下呀 (>ω<)♡"
|
|
732
741
|
});
|
|
733
742
|
const myCardInfo = await this.ctx["bilibili-notify-api"].getUserCardInfo(personalInfo.data.mid.toString(), true);
|
|
734
743
|
this.ctx.emit("bilibili-notify/login-status-report", {
|
|
@@ -739,25 +748,92 @@ var ComRegister = class ComRegister {
|
|
|
739
748
|
this.mergeStopWords(config.wordcloudStopWords);
|
|
740
749
|
this.initAllManager();
|
|
741
750
|
if (config.advancedSub) {
|
|
742
|
-
this.logger.info("
|
|
751
|
+
this.logger.info("主人~女仆正在开启高级订阅呢,请稍等一下,女仆乖乖加载订阅中哦 (>///<)♡");
|
|
743
752
|
this.ctx.emit("bilibili-notify/ready-to-recive");
|
|
744
753
|
} else if (config.subs && config.subs.length > 0) {
|
|
745
754
|
const subs = this.configSubsToSubscription(config.subs);
|
|
746
755
|
await this.initAsyncPart(subs);
|
|
747
|
-
} else this.logger.info("
|
|
756
|
+
} else this.logger.info("主人~女仆初始化完毕啦,但发现还没有添加任何订阅呢 (>_<) 请快点添加,让女仆可以开始努力工作呀♡");
|
|
757
|
+
}
|
|
758
|
+
preInitConfig(subs) {
|
|
759
|
+
for (const sub of Object.values(subs)) {
|
|
760
|
+
if (sub.customLiveMsg.enable) {
|
|
761
|
+
if (!sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
762
|
+
if (!sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
763
|
+
if (!sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
764
|
+
} else {
|
|
765
|
+
sub.customLiveMsg.enable = false;
|
|
766
|
+
sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
767
|
+
sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
768
|
+
sub.customLiveMsg.customLive = this.config.customLive;
|
|
769
|
+
}
|
|
770
|
+
if (sub.customGuardBuy.enable) {
|
|
771
|
+
if (!sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
772
|
+
if (!sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
773
|
+
if (!sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
774
|
+
if (!sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
775
|
+
} else if (this.config.customGuardBuy.enable) {
|
|
776
|
+
sub.customGuardBuy.enable = true;
|
|
777
|
+
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
778
|
+
sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
779
|
+
sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
780
|
+
sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
781
|
+
}
|
|
782
|
+
if (sub.customLiveSummary.enable) {
|
|
783
|
+
if (sub.customLiveSummary.liveSummary.length === 0) sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
784
|
+
} else {
|
|
785
|
+
sub.customLiveSummary.enable = false;
|
|
786
|
+
sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
787
|
+
}
|
|
788
|
+
const dynamicArr = [];
|
|
789
|
+
const dynamicAtAllArr = [];
|
|
790
|
+
const liveArr = [];
|
|
791
|
+
const liveAtAllArr = [];
|
|
792
|
+
const liveGuardBuyArr = [];
|
|
793
|
+
const superchatArr = [];
|
|
794
|
+
const wordcloudArr = [];
|
|
795
|
+
const liveSummaryArr = [];
|
|
796
|
+
for (const platform of sub.target) for (const channel of platform.channelArr) {
|
|
797
|
+
const target = `${platform.platform}:${channel.channelId}`;
|
|
798
|
+
const conditions = [
|
|
799
|
+
["dynamic", dynamicArr],
|
|
800
|
+
["dynamicAtAll", dynamicAtAllArr],
|
|
801
|
+
["live", liveArr],
|
|
802
|
+
["liveAtAll", liveAtAllArr],
|
|
803
|
+
["liveGuardBuy", liveGuardBuyArr],
|
|
804
|
+
["superchat", superchatArr],
|
|
805
|
+
["wordcloud", wordcloudArr],
|
|
806
|
+
["liveSummary", liveSummaryArr]
|
|
807
|
+
];
|
|
808
|
+
for (const [key, arr] of conditions) if (channel[key]) arr.push(target);
|
|
809
|
+
}
|
|
810
|
+
this.pushArrMap.set(sub.uid, {
|
|
811
|
+
dynamicArr,
|
|
812
|
+
dynamicAtAllArr,
|
|
813
|
+
liveArr,
|
|
814
|
+
liveAtAllArr,
|
|
815
|
+
liveSummaryArr,
|
|
816
|
+
liveGuardBuyArr,
|
|
817
|
+
superchatArr,
|
|
818
|
+
wordcloudArr
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
this.logger.info("主人~女仆正在初始化推送群组/频道信息呢,请稍等一下哦 (>ω<)♡");
|
|
822
|
+
this.logger.info(this.pushArrMap);
|
|
748
823
|
}
|
|
749
824
|
registeringForEvents() {
|
|
750
825
|
this.ctx.console.addListener("bilibili-notify/start-login", async () => {
|
|
751
|
-
this.logger.info("
|
|
826
|
+
this.logger.info("主人~女仆正在触发登录事件呢,请稍等一下哦 (>ω<)♡");
|
|
752
827
|
let content;
|
|
753
828
|
try {
|
|
754
829
|
content = await this.ctx["bilibili-notify-api"].getLoginQRCode();
|
|
755
830
|
} catch (_) {
|
|
756
|
-
|
|
831
|
+
this.logger.error("主人呜呜 (;>_<) 女仆在请求 bili login getLoginQRCode() 的时候网络失败啦,请检查网络后再试呀 (>ω<)♡");
|
|
832
|
+
return;
|
|
757
833
|
}
|
|
758
834
|
if (content.code !== 0) return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
759
835
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
760
|
-
msg:
|
|
836
|
+
msg: `主人…呜呜 (;>_<) 女仆获取二维码失败啦,请主人再试一次哦 (>ω<)♡`
|
|
761
837
|
});
|
|
762
838
|
qrcode.default.toBuffer(content.data.url, {
|
|
763
839
|
errorCorrectionLevel: "H",
|
|
@@ -769,10 +845,10 @@ var ComRegister = class ComRegister {
|
|
|
769
845
|
}
|
|
770
846
|
}, async (err, buffer) => {
|
|
771
847
|
if (err) {
|
|
772
|
-
this.logger.error(
|
|
848
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆生成二维码失败啦~错误信息:${err},请主人帮女仆看看问题呀 (>ω<)♡`);
|
|
773
849
|
return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
774
850
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
775
|
-
msg: "
|
|
851
|
+
msg: "主人呜呜 (;>_<) 女仆生成二维码失败啦~"
|
|
776
852
|
});
|
|
777
853
|
}
|
|
778
854
|
const url = `data:image/png;base64,${Buffer.from(buffer).toString("base64")}`;
|
|
@@ -792,22 +868,22 @@ var ComRegister = class ComRegister {
|
|
|
792
868
|
try {
|
|
793
869
|
loginContent = await this.ctx["bilibili-notify-api"].getLoginStatus(content.data.qrcode_key);
|
|
794
870
|
} catch (e) {
|
|
795
|
-
this.logger.error(e);
|
|
871
|
+
this.logger.error(`主人…呜呜 (;>_<) 女仆获取登录信息失败啦~错误信息:${e},请主人帮女仆检查一下呀 (>ω<)♡`);
|
|
796
872
|
return;
|
|
797
873
|
}
|
|
798
874
|
if (loginContent.data.code === 86101) return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
799
875
|
status: BiliLoginStatus.LOGGING_QR,
|
|
800
|
-
msg: "
|
|
876
|
+
msg: "主人~呜呜 (;>_<) 女仆发现您还没有扫码呢,请主人快点扫码呀 (>ω<)♡"
|
|
801
877
|
});
|
|
802
878
|
if (loginContent.data.code === 86090) return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
803
879
|
status: BiliLoginStatus.LOGGING_QR,
|
|
804
|
-
msg: "
|
|
880
|
+
msg: "主人~呜呜 (;>_<) 女仆看到二维码已经扫码了,但还没有确认呢,请主人快点确认呀 (>ω<)♡"
|
|
805
881
|
});
|
|
806
882
|
if (loginContent.data.code === 86038) {
|
|
807
883
|
this.loginTimer();
|
|
808
884
|
return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
809
885
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
810
|
-
msg: "
|
|
886
|
+
msg: "主人呜呜 (;>_<) 女仆发现二维码已经失效啦,请主人重新登录好让女仆继续工作呀 (>ω<)♡"
|
|
811
887
|
});
|
|
812
888
|
}
|
|
813
889
|
if (loginContent.data.code === 0) {
|
|
@@ -825,7 +901,7 @@ var ComRegister = class ComRegister {
|
|
|
825
901
|
this.ctx["bilibili-notify-api"].disposeNotifier();
|
|
826
902
|
this.ctx.emit("bilibili-notify/login-status-report", {
|
|
827
903
|
status: BiliLoginStatus.LOGIN_SUCCESS,
|
|
828
|
-
msg: "
|
|
904
|
+
msg: "主人~女仆看到您已登录啦,请点击按钮重启插件哦~女仆也会在5秒后自动帮您重启的 (>ω<)♡"
|
|
829
905
|
});
|
|
830
906
|
await this.ctx["bilibili-notify"].restartPlugin();
|
|
831
907
|
}
|
|
@@ -833,7 +909,7 @@ var ComRegister = class ComRegister {
|
|
|
833
909
|
this.loginTimer();
|
|
834
910
|
return this.ctx.emit("bilibili-notify/login-status-report", {
|
|
835
911
|
status: BiliLoginStatus.LOGIN_FAILED,
|
|
836
|
-
msg: "
|
|
912
|
+
msg: "主人呜呜 (;>_<) 女仆登录失败啦,请主人再试一次,好让女仆继续工作呀 (>ω<)♡"
|
|
837
913
|
});
|
|
838
914
|
}
|
|
839
915
|
} finally {
|
|
@@ -859,7 +935,7 @@ var ComRegister = class ComRegister {
|
|
|
859
935
|
});
|
|
860
936
|
if (this.config.advancedSub) this.ctx.on("bilibili-notify/advanced-sub", async (subs) => {
|
|
861
937
|
if (Object.keys(subs).length === 0) {
|
|
862
|
-
this.logger.info("
|
|
938
|
+
this.logger.info("主人~女仆初始化完毕啦,但发现还没有添加任何订阅呢 (>_<) 请快点添加,让女仆可以开始努力工作呀♡");
|
|
863
939
|
return;
|
|
864
940
|
}
|
|
865
941
|
if (this.reciveSubTimes >= 1) await this.ctx["bilibili-notify"].restartPlugin();
|
|
@@ -875,24 +951,23 @@ var ComRegister = class ComRegister {
|
|
|
875
951
|
}
|
|
876
952
|
async initAsyncPart(subs) {
|
|
877
953
|
this.ctx["bilibili-notify-live"].clearListeners();
|
|
878
|
-
this.logger.info("
|
|
954
|
+
this.logger.info("主人~女仆已经获取到订阅信息啦,正在乖乖开始加载订阅中哦 (>ω<)♡");
|
|
879
955
|
const groupInfoResult = await this.getGroupInfo();
|
|
880
956
|
if (groupInfoResult.code !== 0) {
|
|
881
|
-
this.logger.error("
|
|
957
|
+
this.logger.error("主人呜呜 (;>_<) 女仆获取分组信息失败啦,插件初始化失败…请主人帮女仆看看问题呀 (>ω<)♡");
|
|
882
958
|
return;
|
|
883
959
|
}
|
|
884
960
|
this.groupInfo = groupInfoResult.data;
|
|
885
961
|
const { code, message } = await this.loadSubFromConfig(subs);
|
|
886
962
|
if (code !== 0) {
|
|
887
|
-
this.logger.error(message);
|
|
888
|
-
this.
|
|
889
|
-
await this.sendPrivateMsg("订阅对象加载失败,插件初始化失败!");
|
|
963
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆加载订阅对象失败啦,插件初始化失败~错误信息:${message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
964
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆加载订阅对象失败啦,插件初始化失败~");
|
|
890
965
|
return;
|
|
891
966
|
}
|
|
892
967
|
this.initManagerAfterLoadSub();
|
|
893
968
|
this.checkIfDynamicDetectIsNeeded();
|
|
894
969
|
this.updateSubNotifier();
|
|
895
|
-
this.logger.info("
|
|
970
|
+
this.logger.info("主人~女仆插件初始化完毕啦!乖乖准备好为您服务哦 (>ω<)♡");
|
|
896
971
|
}
|
|
897
972
|
mergeStopWords(stopWordsStr) {
|
|
898
973
|
if (!stopWordsStr || stopWordsStr.trim() === "") {
|
|
@@ -965,7 +1040,7 @@ var ComRegister = class ComRegister {
|
|
|
965
1040
|
async sendPrivateMsg(content) {
|
|
966
1041
|
if (this.config.master.enable) {
|
|
967
1042
|
if (this.privateBot?.status !== koishi.Universal.Status.ONLINE) {
|
|
968
|
-
this.logger.error(
|
|
1043
|
+
this.logger.error(`主人~呜呜 (;>_<) 女仆发现 ${this.privateBot.platform} 机器人还没初始化完毕呢,暂时不能进行推送~女仆会乖乖等它准备好 (>ω<)♡`);
|
|
969
1044
|
return;
|
|
970
1045
|
}
|
|
971
1046
|
if (this.config.master.masterAccountGuildId) await this.privateBot.sendPrivateMessage(this.config.master.masterAccount, content, this.config.master.masterAccountGuildId);
|
|
@@ -974,23 +1049,23 @@ var ComRegister = class ComRegister {
|
|
|
974
1049
|
}
|
|
975
1050
|
async sendPrivateMsgAndRebootService() {
|
|
976
1051
|
if (this.rebootCount >= 3) {
|
|
977
|
-
this.logger.error("
|
|
978
|
-
await this.sendPrivateMsg("
|
|
1052
|
+
this.logger.error("主人呜呜 (;>_<) 女仆已经重启插件三次啦,请主人检查一下机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
1053
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆已经重启插件三次啦,请主人检查一下机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
979
1054
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
980
1055
|
return;
|
|
981
1056
|
}
|
|
982
1057
|
this.rebootCount++;
|
|
983
|
-
this.logger.info("
|
|
984
|
-
if (await this.ctx["bilibili-notify"].restartPlugin()) this.logger.info("
|
|
1058
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现插件出现未知错误啦,正在乖乖重启插件中~请主人稍等哦 (>ω<)♡");
|
|
1059
|
+
if (await this.ctx["bilibili-notify"].restartPlugin()) this.logger.info("主人~女仆成功重启插件啦!乖乖准备继续为您服务哦 (>ω<)♡");
|
|
985
1060
|
else {
|
|
986
|
-
this.logger.error("
|
|
987
|
-
await this.sendPrivateMsg("
|
|
1061
|
+
this.logger.error("主人呜呜 (;>_<) 女仆重启插件失败啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
1062
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆重启插件失败啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
988
1063
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
989
1064
|
}
|
|
990
1065
|
}
|
|
991
1066
|
async sendPrivateMsgAndStopService() {
|
|
992
|
-
await this.sendPrivateMsg("
|
|
993
|
-
this.logger.error("
|
|
1067
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆发现插件发生未知错误啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
1068
|
+
this.logger.error("主人呜呜 (;>_<) 女仆发现插件发生未知错误啦,请主人检查机器人状态,然后输入指令 `bn start` 来启动插件哦 (>ω<)♡");
|
|
994
1069
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
995
1070
|
}
|
|
996
1071
|
async sendMessageWithRetry(bot, channelId, content) {
|
|
@@ -1001,76 +1076,10 @@ var ComRegister = class ComRegister {
|
|
|
1001
1076
|
}, 2e3);
|
|
1002
1077
|
return;
|
|
1003
1078
|
}
|
|
1004
|
-
this.logger.error(
|
|
1005
|
-
await this.sendPrivateMsg(
|
|
1079
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发送群组ID: ${channelId} 的消息失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1080
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发送群组ID: ${channelId} 的消息失败啦~请主人帮女仆看看呀 (>ω<)♡`);
|
|
1006
1081
|
});
|
|
1007
1082
|
}
|
|
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
1083
|
async pushMessage(targets, content) {
|
|
1075
1084
|
const t = {};
|
|
1076
1085
|
for (const target of targets) {
|
|
@@ -1084,16 +1093,16 @@ var ComRegister = class ComRegister {
|
|
|
1084
1093
|
let num = 0;
|
|
1085
1094
|
const sendMessageByBot = async (channelId, botIndex = 0, retry = 3e3) => {
|
|
1086
1095
|
if (!bots[botIndex]) {
|
|
1087
|
-
this.logger.warn(
|
|
1096
|
+
this.logger.warn(`主人呜呜 (;>_<) 女仆发现 ${platform} 没有配置对应机器人呢,暂时无法进行推送哦 (>ω<)♡`);
|
|
1088
1097
|
return;
|
|
1089
1098
|
}
|
|
1090
1099
|
if (bots[botIndex].status !== koishi.Universal.Status.ONLINE) {
|
|
1091
1100
|
if (retry >= 3e3 * 2 ** 5) {
|
|
1092
|
-
this.logger.error(
|
|
1093
|
-
await this.sendPrivateMsg(
|
|
1101
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发现 ${platform} 机器人还没初始化完毕呢~已经重试5次啦,暂时放弃推送了 (>ω<)♡`);
|
|
1102
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发现 ${platform} 机器人还没初始化完毕呢~已经重试5次啦,暂时放弃推送了 (>ω<)♡`);
|
|
1094
1103
|
return;
|
|
1095
1104
|
}
|
|
1096
|
-
this.logger.error(
|
|
1105
|
+
this.logger.error(`主人~女仆发现 ${platform} 机器人还没初始化完毕呢,暂时无法推送~${retry / 1e3} 秒后女仆会再试一次哦 (>ω<)♡`);
|
|
1097
1106
|
await this.ctx.sleep(retry);
|
|
1098
1107
|
await sendMessageByBot(channelId, botIndex, retry * 2);
|
|
1099
1108
|
return;
|
|
@@ -1103,46 +1112,46 @@ var ComRegister = class ComRegister {
|
|
|
1103
1112
|
num++;
|
|
1104
1113
|
await this.ctx.sleep(500);
|
|
1105
1114
|
} catch (e) {
|
|
1106
|
-
this.logger.error(e);
|
|
1115
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆遇到错误啦~错误信息:${e},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1107
1116
|
if (bots.length > 1) await sendMessageByBot(channelId, botIndex++);
|
|
1108
1117
|
}
|
|
1109
1118
|
};
|
|
1110
1119
|
for (const channelId of t[platform]) await sendMessageByBot(channelId);
|
|
1111
|
-
this.logger.info(
|
|
1120
|
+
this.logger.info(`主人~女仆成功推送了 ${num} 条消息啦!乖乖完成任务~(>ω<)♡`);
|
|
1112
1121
|
}
|
|
1113
1122
|
}
|
|
1114
1123
|
async broadcastToTargets(uid, content, type) {
|
|
1115
1124
|
const record = this.pushArrMap.get(uid);
|
|
1116
1125
|
if (!record) return;
|
|
1117
1126
|
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(
|
|
1127
|
+
this.logger.info(`主人~女仆这次要推送的对象是 ${uid},推送类型是 ${PushTypeMsg[type]} 哦~乖乖完成任务啦 (>ω<)♡`);
|
|
1119
1128
|
if (type === PushType.StartBroadcasting && record.liveAtAllArr?.length > 0) {
|
|
1120
|
-
this.logger.info(
|
|
1129
|
+
this.logger.info(`主人~女仆推送给 @全体 的消息啦~对象列表:${record.liveAtAllArr} 哦 (>ω<)♡`);
|
|
1121
1130
|
const atAllArr = structuredClone(record.liveAtAllArr);
|
|
1122
1131
|
await withRetry(() => this.pushMessage(atAllArr, koishi.h.at("all")), 1);
|
|
1123
1132
|
}
|
|
1124
1133
|
if (type === PushType.Dynamic && record.dynamicArr?.length > 0) {
|
|
1125
1134
|
if (record.dynamicAtAllArr?.length > 0) {
|
|
1126
|
-
this.logger.info(
|
|
1135
|
+
this.logger.info(`主人~女仆推送动态给 @全体 哦~对象列表:${record.dynamicAtAllArr} (>ω<)♡`);
|
|
1127
1136
|
const dynamicAtAllArr = structuredClone(record.dynamicAtAllArr);
|
|
1128
1137
|
await withRetry(() => this.pushMessage(dynamicAtAllArr, koishi.h.at("all")), 1);
|
|
1129
1138
|
}
|
|
1130
|
-
this.logger.info(
|
|
1139
|
+
this.logger.info(`主人~女仆正在推送动态啦~对象列表:${record.dynamicArr} (>ω<)♡`);
|
|
1131
1140
|
const dynamicArr = structuredClone(record.dynamicArr);
|
|
1132
1141
|
await withRetry(() => this.pushMessage(dynamicArr, (0, koishi.h)("message", content)), 1);
|
|
1133
1142
|
}
|
|
1134
1143
|
if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length > 0) {
|
|
1135
|
-
this.logger.info(
|
|
1144
|
+
this.logger.info(`主人~女仆正在推送直播啦~对象列表:${record.liveArr} (>ω<)♡`);
|
|
1136
1145
|
const liveArr = structuredClone(record.liveArr);
|
|
1137
1146
|
await withRetry(() => this.pushMessage(liveArr, (0, koishi.h)("message", content)), 1);
|
|
1138
1147
|
}
|
|
1139
1148
|
if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length > 0) {
|
|
1140
|
-
this.logger.info(
|
|
1149
|
+
this.logger.info(`主人~女仆正在推送直播守护购买消息啦~对象列表:${record.liveGuardBuyArr} (>ω<)♡`);
|
|
1141
1150
|
const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
|
|
1142
1151
|
await withRetry(() => this.pushMessage(liveGuardBuyArr, (0, koishi.h)("message", content)), 1);
|
|
1143
1152
|
}
|
|
1144
1153
|
if (type === PushType.Superchat && record.superchatArr?.length > 0) {
|
|
1145
|
-
this.logger.info(
|
|
1154
|
+
this.logger.info(`主人~女仆正在推送 SC 消息啦~对象列表:${record.superchatArr} (>ω<)♡`);
|
|
1146
1155
|
const superchatArr = structuredClone(record.superchatArr);
|
|
1147
1156
|
await withRetry(() => this.pushMessage(superchatArr, (0, koishi.h)("message", content)), 1);
|
|
1148
1157
|
}
|
|
@@ -1153,16 +1162,16 @@ var ComRegister = class ComRegister {
|
|
|
1153
1162
|
const wordcloudOnlyArr = wordcloudArr.filter((item) => !liveSummaryArr.includes(item));
|
|
1154
1163
|
const liveSummaryOnlyArr = liveSummaryArr.filter((item) => !wordcloudArr.includes(item));
|
|
1155
1164
|
if (wordcloudAndLiveSummaryArr.length > 0) {
|
|
1156
|
-
this.logger.info(
|
|
1165
|
+
this.logger.info(`主人~女仆正在推送词云和直播总结啦~对象列表:${wordcloudAndLiveSummaryArr} (>ω<)♡`);
|
|
1157
1166
|
const msgs = content.filter(Boolean);
|
|
1158
1167
|
if (msgs.length > 0) await withRetry(() => this.pushMessage(wordcloudAndLiveSummaryArr, (0, koishi.h)("message", msgs)), 1);
|
|
1159
1168
|
}
|
|
1160
1169
|
if (content[0] && wordcloudOnlyArr.length > 0) {
|
|
1161
|
-
this.logger.info(
|
|
1170
|
+
this.logger.info(`主人~女仆正在推送词云啦~对象列表:${wordcloudOnlyArr} (>ω<)♡`);
|
|
1162
1171
|
await withRetry(() => this.pushMessage(wordcloudOnlyArr, (0, koishi.h)("message", content[0])), 1);
|
|
1163
1172
|
}
|
|
1164
1173
|
if (content[1] && liveSummaryOnlyArr.length > 0) {
|
|
1165
|
-
this.logger.info(
|
|
1174
|
+
this.logger.info(`主人~女仆正在推送直播总结啦~对象列表:${liveSummaryOnlyArr} (>ω<)♡`);
|
|
1166
1175
|
await withRetry(() => this.pushMessage(liveSummaryOnlyArr, (0, koishi.h)("message", content[1])), 1);
|
|
1167
1176
|
}
|
|
1168
1177
|
}
|
|
@@ -1173,23 +1182,26 @@ var ComRegister = class ComRegister {
|
|
|
1173
1182
|
const content = await withRetry(async () => {
|
|
1174
1183
|
return await this.ctx["bilibili-notify-api"].getAllDynamic();
|
|
1175
1184
|
}, 1).catch((e) => {
|
|
1176
|
-
this.logger.error(
|
|
1185
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect getAllDynamic() 时发生了错误~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1177
1186
|
});
|
|
1178
|
-
if (!content)
|
|
1187
|
+
if (!content || !content.data) {
|
|
1188
|
+
this.logger.error("主人呜呜 (;>_<) 女仆在执行 dynamicDetect 时获取动态内容失败啦~请主人帮女仆看看呀 (>ω<)♡");
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1179
1191
|
if (content.code !== 0) switch (content.code) {
|
|
1180
1192
|
case -101:
|
|
1181
|
-
this.logger.error("
|
|
1182
|
-
await this.sendPrivateMsg("
|
|
1193
|
+
this.logger.error("主人…呜呜,女仆发现您还没登录账号呢 (;>_<)插件已经乖乖停止工作啦…请主人快点登录,让女仆可以继续努力为您服务~ (>ω<)♡");
|
|
1194
|
+
await this.sendPrivateMsg("主人…呜呜,女仆发现您还没登录账号呢 (;>_<)插件已经乖乖停止工作啦…请主人快点登录,让女仆可以继续努力为您服务~ (>ω<)♡");
|
|
1183
1195
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1184
1196
|
break;
|
|
1185
1197
|
case -352:
|
|
1186
|
-
this.logger.error("
|
|
1187
|
-
await this.sendPrivateMsg("
|
|
1198
|
+
this.logger.error("主人…呜呜 (;>_<) 女仆发现账号被风控啦~插件已经乖乖停止工作了…请主人输入指令 bili cap,然后按照提示来解除风控吧~女仆会在旁边乖乖等您完成的 (>ω<)♡");
|
|
1199
|
+
await this.sendPrivateMsg("主人…呜呜 (;>_<) 女仆发现账号被风控啦~插件已经乖乖停止工作了…请主人输入指令 bili cap,然后按照提示来解除风控吧~女仆会在旁边乖乖等您完成的 (>ω<)♡");
|
|
1188
1200
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1189
1201
|
break;
|
|
1190
1202
|
default:
|
|
1191
|
-
this.logger.error(
|
|
1192
|
-
await this.sendPrivateMsg(
|
|
1203
|
+
this.logger.error(`主人…呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件~女仆会乖乖等着的 (>ω<)♡`);
|
|
1204
|
+
await this.sendPrivateMsg(`主人…呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件~女仆会乖乖等着的 (>ω<)♡`);
|
|
1193
1205
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1194
1206
|
break;
|
|
1195
1207
|
}
|
|
@@ -1218,7 +1230,7 @@ var ComRegister = class ComRegister {
|
|
|
1218
1230
|
if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
|
|
1219
1231
|
return;
|
|
1220
1232
|
}
|
|
1221
|
-
this.logger.error(
|
|
1233
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect generateDynamicImg() 时推送卡片发送失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1222
1234
|
await this.sendPrivateMsgAndStopService();
|
|
1223
1235
|
});
|
|
1224
1236
|
if (!buffer) continue;
|
|
@@ -1230,7 +1242,7 @@ var ComRegister = class ComRegister {
|
|
|
1230
1242
|
else dUrl = `${name$2}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
|
|
1231
1243
|
let aigc = "";
|
|
1232
1244
|
if (this.config.ai.enable) {
|
|
1233
|
-
this.logger.info("
|
|
1245
|
+
this.logger.info("主人~女仆正在努力生成 AI 动态推送内容中呢…请稍等一下呀 (>ω<)♡");
|
|
1234
1246
|
if (item.type === "DYNAMIC_TYPE_AV") {
|
|
1235
1247
|
const title = item.modules.module_dynamic.major.archive.title;
|
|
1236
1248
|
const desc = item.modules.module_dynamic.major.archive.desc;
|
|
@@ -1241,9 +1253,9 @@ var ComRegister = class ComRegister {
|
|
|
1241
1253
|
const desc = item.modules.module_dynamic.major.opus.summary.text;
|
|
1242
1254
|
aigc = (await this.ctx["bilibili-notify-api"].chatWithAI(`请你根据以下图文动态的标题和内容,帮我写一份简短的动态播报,标题:${title},内容:${desc}`)).choices[0].message.content;
|
|
1243
1255
|
}
|
|
1244
|
-
this.logger.info(
|
|
1256
|
+
this.logger.info(`主人~女仆的 AI 动态推送内容生成完毕啦!乖乖准备好发送给大家哦 (>ω<)♡`);
|
|
1245
1257
|
}
|
|
1246
|
-
this.logger.info(
|
|
1258
|
+
this.logger.info(`主人~女仆正在推送动态中呢…请稍等哦 (>ω<)♡`);
|
|
1247
1259
|
await this.broadcastToTargets(uid, (0, koishi.h)("message", [
|
|
1248
1260
|
koishi.h.image(buffer, "image/jpeg"),
|
|
1249
1261
|
koishi.h.text(aigc),
|
|
@@ -1259,7 +1271,7 @@ var ComRegister = class ComRegister {
|
|
|
1259
1271
|
}
|
|
1260
1272
|
}
|
|
1261
1273
|
if (!currentPushDyn[uid]) currentPushDyn[uid] = item;
|
|
1262
|
-
this.logger.info(
|
|
1274
|
+
this.logger.info(`主人~女仆的动态推送完毕啦!乖乖完成任务~(>ω<)♡`);
|
|
1263
1275
|
}
|
|
1264
1276
|
}
|
|
1265
1277
|
}
|
|
@@ -1273,46 +1285,46 @@ var ComRegister = class ComRegister {
|
|
|
1273
1285
|
debug_dynamicDetect() {
|
|
1274
1286
|
const handler = async () => {
|
|
1275
1287
|
const currentPushDyn = {};
|
|
1276
|
-
this.logger.info(
|
|
1288
|
+
this.logger.info(`主人~女仆正在开始获取动态信息呢…请稍等一下呀 (>ω<)♡`);
|
|
1277
1289
|
const content = await withRetry(async () => {
|
|
1278
1290
|
return await this.ctx["bilibili-notify-api"].getAllDynamic();
|
|
1279
1291
|
}, 1).catch((e) => {
|
|
1280
|
-
this.logger.error(
|
|
1292
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect getAllDynamic() 时遇到错误啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1281
1293
|
});
|
|
1282
1294
|
if (!content) return;
|
|
1283
1295
|
if (content.code !== 0) switch (content.code) {
|
|
1284
1296
|
case -101:
|
|
1285
|
-
this.logger.error(
|
|
1286
|
-
await this.sendPrivateMsg(
|
|
1297
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发现账号还没登录呢,插件已经停止工作啦~请主人快点登录好让女仆继续努力呀 (>ω<)♡`);
|
|
1298
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发现账号还没登录呢,插件已经停止工作啦~请主人快点登录好让女仆继续努力呀 (>ω<)♡`);
|
|
1287
1299
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1288
1300
|
break;
|
|
1289
1301
|
case -352:
|
|
1290
|
-
this.logger.error("
|
|
1291
|
-
await this.sendPrivateMsg("
|
|
1302
|
+
this.logger.error("主人呜呜 (;>_<) 女仆发现账号被风控啦,插件已经停止工作~请主人输入指令 `bili cap` 并根据提示解除风控呀~女仆会乖乖等您完成的 (>ω<)♡");
|
|
1303
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆发现账号被风控啦,插件已经停止工作~请主人输入指令 `bili cap` 并根据提示解除风控呀~女仆会乖乖等您完成的 (>ω<)♡");
|
|
1292
1304
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1293
1305
|
break;
|
|
1294
1306
|
default:
|
|
1295
|
-
this.logger.error(
|
|
1296
|
-
await this.sendPrivateMsg(
|
|
1307
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件呀~女仆会乖乖等着的 (>ω<)♡`);
|
|
1308
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆在获取动态信息时遇到问题啦~错误码:${content.code},错误信息:${content.message},请主人排除问题后输入指令 \`bn start\` 重启插件呀~女仆会乖乖等着的 (>ω<)♡`);
|
|
1297
1309
|
await this.ctx["bilibili-notify"].disposePlugin();
|
|
1298
1310
|
break;
|
|
1299
1311
|
}
|
|
1300
|
-
this.logger.info("
|
|
1312
|
+
this.logger.info("主人~女仆成功获取动态信息啦!正在乖乖开始处理动态信息呢 (>ω<)♡");
|
|
1301
1313
|
const items = content.data.items;
|
|
1302
1314
|
for (const item of items) {
|
|
1303
1315
|
if (!item) continue;
|
|
1304
1316
|
const postTime = item.modules.module_author.pub_ts;
|
|
1305
1317
|
const uid = item.modules.module_author.mid.toString();
|
|
1306
1318
|
const name$2 = item.modules.module_author.name;
|
|
1307
|
-
this.logger.info(
|
|
1319
|
+
this.logger.info(`主人主人~女仆已经成功拿到动态信息啦!UP主是:${name$2},UID:${uid},动态发布时间是:${luxon.DateTime.fromSeconds(postTime).toFormat("yyyy-MM-dd HH:mm:ss")} 哦~女仆超乖地汇报给您呢 (>ω<)♡`);
|
|
1308
1320
|
if (this.dynamicTimelineManager.has(uid)) {
|
|
1309
|
-
this.logger.info("
|
|
1321
|
+
this.logger.info("主人订阅订阅了这位UP主啦…女仆正在努力检查动态时间线呢 (>▽<)ゞ♡");
|
|
1310
1322
|
const timeline = this.dynamicTimelineManager.get(uid);
|
|
1311
|
-
this.logger.info(
|
|
1323
|
+
this.logger.info(`主人主人~女仆找到了上次的推送时间线哟:${luxon.DateTime.fromSeconds(timeline).toFormat("yyyy-MM-dd HH:mm:ss")} ~请您看看是不是对的呢 (〃・ω・〃)♡`);
|
|
1312
1324
|
if (timeline < postTime) {
|
|
1313
|
-
this.logger.info("
|
|
1325
|
+
this.logger.info("主人~这条动态需要推送哟!女仆已经开始乖乖进行推送啦 (๑•̀ω•́๑)✧♡");
|
|
1314
1326
|
const sub = this.subManager.get(uid);
|
|
1315
|
-
this.logger.info("
|
|
1327
|
+
this.logger.info("主人~女仆正在努力开始渲染推送卡片呢~请稍等一下呀 (〃ノωノ)♡");
|
|
1316
1328
|
const buffer = await withRetry(async () => {
|
|
1317
1329
|
return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
|
|
1318
1330
|
}, 1).catch(async (e) => {
|
|
@@ -1329,25 +1341,25 @@ var ComRegister = class ComRegister {
|
|
|
1329
1341
|
if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
|
|
1330
1342
|
return;
|
|
1331
1343
|
}
|
|
1332
|
-
this.logger.error(
|
|
1344
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 dynamicDetect generateDynamicImg() 时推送卡片发送失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1333
1345
|
await this.sendPrivateMsgAndStopService();
|
|
1334
1346
|
});
|
|
1335
1347
|
if (!buffer) continue;
|
|
1336
|
-
this.logger.info("
|
|
1348
|
+
this.logger.info("主人~女仆渲染推送卡片成功啦!乖乖准备好发送啦 (>ω<)♡");
|
|
1337
1349
|
let dUrl = "";
|
|
1338
1350
|
if (this.config.dynamicUrl) {
|
|
1339
|
-
this.logger.info("
|
|
1351
|
+
this.logger.info("主人~女仆发现需要发送动态链接啦,正在努力生成链接中呢 (>ω<)♡");
|
|
1340
1352
|
if (item.type === "DYNAMIC_TYPE_AV") if (this.config.dynamicVideoUrlToBV) {
|
|
1341
1353
|
const bv = item.modules.module_dynamic.major.archive.jump_url.match(/BV[0-9A-Za-z]+/);
|
|
1342
1354
|
dUrl = bv ? bv[0] : "";
|
|
1343
1355
|
} else dUrl = `${name$2}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
|
|
1344
1356
|
else dUrl = `${name$2}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
|
|
1345
|
-
this.logger.info("
|
|
1357
|
+
this.logger.info("主人~女仆成功生成动态链接啦!准备好发送给大家啦 (>ω<)♡");
|
|
1346
1358
|
}
|
|
1347
|
-
this.logger.info("
|
|
1359
|
+
this.logger.info("主人~女仆正在推送动态中呢…请稍等哦 (>ω<)♡");
|
|
1348
1360
|
await this.broadcastToTargets(uid, (0, koishi.h)("message", [koishi.h.image(buffer, "image/jpeg"), koishi.h.text(dUrl)]), PushType.Dynamic);
|
|
1349
1361
|
if (this.config.pushImgsInDynamic) {
|
|
1350
|
-
this.logger.info("
|
|
1362
|
+
this.logger.info("主人~女仆发现动态里有图片要发送哦,正在努力发送中呢 (>ω<)♡");
|
|
1351
1363
|
if (item.type === "DYNAMIC_TYPE_DRAW") {
|
|
1352
1364
|
const pics = item.modules?.module_dynamic?.major?.opus?.pics;
|
|
1353
1365
|
if (pics) {
|
|
@@ -1355,20 +1367,20 @@ var ComRegister = class ComRegister {
|
|
|
1355
1367
|
await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
|
|
1356
1368
|
}
|
|
1357
1369
|
}
|
|
1358
|
-
this.logger.info("
|
|
1370
|
+
this.logger.info("主人~女仆已经把动态中的图片发送完毕啦!乖乖完成任务啦 (>ω<)♡");
|
|
1359
1371
|
}
|
|
1360
1372
|
if (!currentPushDyn[uid]) currentPushDyn[uid] = item;
|
|
1361
|
-
this.logger.info("
|
|
1373
|
+
this.logger.info("主人~女仆的动态推送完毕啦!乖乖完成任务~(>ω<)♡");
|
|
1362
1374
|
}
|
|
1363
1375
|
}
|
|
1364
1376
|
}
|
|
1365
|
-
this.logger.info("
|
|
1377
|
+
this.logger.info("主人~女仆已经把动态信息处理完毕啦!一切都乖乖完成啦 (>ω<)♡");
|
|
1366
1378
|
for (const uid in currentPushDyn) {
|
|
1367
1379
|
const postTime = currentPushDyn[uid].modules.module_author.pub_ts;
|
|
1368
1380
|
this.dynamicTimelineManager.set(uid, postTime);
|
|
1369
|
-
this.logger.info(
|
|
1381
|
+
this.logger.info(`主人~女仆成功更新了时间线啦!UP主:${uid},时间线:${luxon.DateTime.fromSeconds(postTime).toFormat("yyyy-MM-dd HH:mm:ss")} 哦~女仆超乖地汇报给您呢 (>ω<)♡`);
|
|
1370
1382
|
}
|
|
1371
|
-
this.logger.info(
|
|
1383
|
+
this.logger.info(`主人~女仆这次要推送的动态数量是:${Object.keys(currentPushDyn).length} 条哦~乖乖完成任务啦 (>ω<)♡`);
|
|
1372
1384
|
};
|
|
1373
1385
|
return withLock(handler);
|
|
1374
1386
|
}
|
|
@@ -1399,7 +1411,7 @@ var ComRegister = class ComRegister {
|
|
|
1399
1411
|
}
|
|
1400
1412
|
async getLiveRoomInfo(roomId) {
|
|
1401
1413
|
const data = await withRetry(async () => await this.ctx["bilibili-notify-api"].getLiveRoomInfo(roomId)).then((content) => content.data).catch((e) => {
|
|
1402
|
-
this.logger.error(
|
|
1414
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 liveDetect getLiveRoomInfo 时遇到错误啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1403
1415
|
});
|
|
1404
1416
|
if (!data) {
|
|
1405
1417
|
await this.sendPrivateMsgAndStopService();
|
|
@@ -1411,7 +1423,7 @@ var ComRegister = class ComRegister {
|
|
|
1411
1423
|
const buffer = await withRetry(async () => {
|
|
1412
1424
|
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
1425
|
}, 1).catch((e) => {
|
|
1414
|
-
this.logger.error(
|
|
1426
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 liveDetect generateLiveImg() 时推送卡片生成失败啦~原因:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1415
1427
|
});
|
|
1416
1428
|
if (!buffer) return await this.sendPrivateMsgAndStopService();
|
|
1417
1429
|
const msg = (0, koishi.h)("message", [koishi.h.image(buffer, "image/jpeg"), koishi.h.text(liveNotifyMsg || "")]);
|
|
@@ -1440,33 +1452,33 @@ var ComRegister = class ComRegister {
|
|
|
1440
1452
|
let masterInfo;
|
|
1441
1453
|
const liveData = { likedNum: "0" };
|
|
1442
1454
|
const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
|
|
1443
|
-
this.logger.info("
|
|
1444
|
-
this.logger.info("
|
|
1455
|
+
this.logger.info("主人~女仆正在开始制作弹幕词云呢~请稍等一下呀 (〃ノωノ)♡");
|
|
1456
|
+
this.logger.info("主人~女仆正在努力获取前90热词呢~请稍等哦 (>ω<)♡");
|
|
1445
1457
|
const words = Object.entries(danmakuWeightRecord);
|
|
1446
1458
|
const danmaker = Object.entries(danmakuSenderRecord);
|
|
1447
1459
|
const img = await (async () => {
|
|
1448
1460
|
if (words.length < 50) {
|
|
1449
|
-
this.logger.info("
|
|
1461
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现热词不足50个呢,本次弹幕词云只好放弃啦 (>ω<)♡");
|
|
1450
1462
|
return;
|
|
1451
1463
|
}
|
|
1452
1464
|
const top90Words = words.sort((a, b) => b[1] - a[1]).slice(0, 90);
|
|
1453
|
-
this.logger.info("
|
|
1465
|
+
this.logger.info("主人~女仆整理好了弹幕词云前90词及权重啦~请主人过目哦 (>ω<)♡");
|
|
1454
1466
|
this.logger.info(top90Words);
|
|
1455
|
-
this.logger.info("
|
|
1467
|
+
this.logger.info("主人~女仆正在准备生成弹幕词云呢~请稍等一下呀 (>ω<)♡");
|
|
1456
1468
|
const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
|
|
1457
1469
|
return koishi.h.image(buffer, "image/jpeg");
|
|
1458
1470
|
})();
|
|
1459
1471
|
const summary = await (async () => {
|
|
1460
1472
|
if (danmaker.length < 5) {
|
|
1461
|
-
this.logger.info("
|
|
1473
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现发言人数不足5位呢,本次弹幕词云只好放弃啦 (>ω<)♡");
|
|
1462
1474
|
return;
|
|
1463
1475
|
}
|
|
1464
|
-
this.logger.info("
|
|
1476
|
+
this.logger.info("主人~女仆正在开始构建弹幕发送排行榜消息呢~请稍等呀 (>ω<)♡");
|
|
1465
1477
|
const danmakuSenderCount = Object.keys(danmakuSenderRecord).length;
|
|
1466
1478
|
const danmakuCount = Object.values(danmakuSenderRecord).reduce((sum, val) => sum + val, 0);
|
|
1467
1479
|
const top5DanmakuSender = Object.entries(danmakuSenderRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
|
|
1468
1480
|
if (this.config.ai.enable) {
|
|
1469
|
-
this.logger.info("AI
|
|
1481
|
+
this.logger.info("主人~女仆发现 AI 直播总结功能已开启啦,正在努力生成 AI 直播总结呢 (>ω<)♡");
|
|
1470
1482
|
const top10Words = words.sort((a, b) => b[1] - a[1]).slice(0, 10);
|
|
1471
1483
|
const liveSummaryData = {
|
|
1472
1484
|
medalName: masterInfo.medalName,
|
|
@@ -1491,7 +1503,7 @@ var ComRegister = class ComRegister {
|
|
|
1491
1503
|
别以为发这么点弹幕就能糊弄过去,本兔可是盯着你们的!下次再偷懒小心被我踹飞!🐰🥕
|
|
1492
1504
|
|
|
1493
1505
|
以下是直播数据:${JSON.stringify(liveSummaryData)}`);
|
|
1494
|
-
this.logger.info("AI
|
|
1506
|
+
this.logger.info("主人~女仆生成好了 AI 直播总结啦,请主人过目哦 (>ω<)♡");
|
|
1495
1507
|
this.logger.info(res.choices[0].message.content);
|
|
1496
1508
|
return res.choices[0].message.content;
|
|
1497
1509
|
}
|
|
@@ -1507,13 +1519,13 @@ var ComRegister = class ComRegister {
|
|
|
1507
1519
|
};
|
|
1508
1520
|
const pushAtTimeFunc = async () => {
|
|
1509
1521
|
if (!await useLiveRoomInfo(LiveType.LiveBroadcast) && !await useMasterInfo(LiveType.LiveBroadcast)) {
|
|
1510
|
-
await this.sendPrivateMsg("
|
|
1522
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,推送直播卡片也失败了~请主人帮女仆看看呀 (>ω<)♡");
|
|
1511
1523
|
return await this.sendPrivateMsgAndStopService();
|
|
1512
1524
|
}
|
|
1513
1525
|
if (liveRoomInfo.live_status === 0 || liveRoomInfo.live_status === 2) {
|
|
1514
1526
|
liveStatus = false;
|
|
1515
1527
|
pushAtTimeTimer?.();
|
|
1516
|
-
await this.sendPrivateMsg("
|
|
1528
|
+
await this.sendPrivateMsg("主人~女仆发现直播间已下播啦!可能与直播间的连接断开了,请主人使用指令 `bn restart` 重启插件呀 (>ω<)♡");
|
|
1517
1529
|
return;
|
|
1518
1530
|
}
|
|
1519
1531
|
liveTime = liveRoomInfo.live_time;
|
|
@@ -1558,8 +1570,8 @@ var ComRegister = class ComRegister {
|
|
|
1558
1570
|
pushAtTimeTimer?.();
|
|
1559
1571
|
pushAtTimeTimer = null;
|
|
1560
1572
|
this.ctx["bilibili-notify-live"].closeListener(sub.roomid);
|
|
1561
|
-
await this.sendPrivateMsg(
|
|
1562
|
-
this.logger.error(
|
|
1573
|
+
await this.sendPrivateMsg(`主人呜呜 (;>_<) 女仆发现 [${sub.roomid}] 直播间连接发生错误啦,请主人帮女仆看看呀 (>ω<)♡`);
|
|
1574
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆发现 [${sub.roomid}] 直播间连接发生错误啦,请主人帮女仆看看呀 (>ω<)♡`);
|
|
1563
1575
|
},
|
|
1564
1576
|
onIncomeDanmu: ({ body }) => {
|
|
1565
1577
|
this.segmentDanmaku(body.content, danmakuWeightRecord);
|
|
@@ -1612,21 +1624,21 @@ var ComRegister = class ComRegister {
|
|
|
1612
1624
|
onLiveStart: async () => {
|
|
1613
1625
|
const now = Date.now();
|
|
1614
1626
|
if (now - lastLiveStart < LIVE_EVENT_COOLDOWN) {
|
|
1615
|
-
this.logger.warn(
|
|
1627
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 的开播事件在冷却期内,所以被忽略啦 (>ω<)♡`);
|
|
1616
1628
|
return;
|
|
1617
1629
|
}
|
|
1618
1630
|
lastLiveStart = now;
|
|
1619
1631
|
if (liveStatus) {
|
|
1620
|
-
this.logger.warn(
|
|
1632
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 已经是开播状态啦,所以忽略了重复的开播事件哦 (>ω<)♡`);
|
|
1621
1633
|
return;
|
|
1622
1634
|
}
|
|
1623
1635
|
liveStatus = true;
|
|
1624
1636
|
if (!await useLiveRoomInfo(LiveType.StartBroadcasting) && !await useMasterInfo(LiveType.StartBroadcasting)) {
|
|
1625
1637
|
liveStatus = false;
|
|
1626
|
-
await this.sendPrivateMsg("
|
|
1638
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,推送直播开播卡片也失败了,请主人帮女仆看看呀 (>ω<)♡");
|
|
1627
1639
|
return await this.sendPrivateMsgAndStopService();
|
|
1628
1640
|
}
|
|
1629
|
-
this.logger.info(
|
|
1641
|
+
this.logger.info(`主人~女仆查到房间号是:${masterInfo.roomId},开播时的粉丝数有:${masterInfo.liveOpenFollowerNum} 哦~女仆乖乖汇报完毕 (>ω<)♡`);
|
|
1630
1642
|
liveTime = liveRoomInfo?.live_time || luxon.DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1631
1643
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1632
1644
|
const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
|
|
@@ -1645,21 +1657,21 @@ var ComRegister = class ComRegister {
|
|
|
1645
1657
|
onLiveEnd: async () => {
|
|
1646
1658
|
const now = Date.now();
|
|
1647
1659
|
if (now - lastLiveEnd < LIVE_EVENT_COOLDOWN) {
|
|
1648
|
-
this.logger.warn(
|
|
1660
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 的下播事件在冷却期内,所以被忽略啦 (>ω<)♡`);
|
|
1649
1661
|
return;
|
|
1650
1662
|
}
|
|
1651
1663
|
lastLiveEnd = now;
|
|
1652
1664
|
if (!liveStatus) {
|
|
1653
|
-
this.logger.warn(
|
|
1665
|
+
this.logger.warn(`主人~女仆发现 [${sub.roomid}] 已经是下播状态啦,所以忽略了重复的下播事件哦 (>ω<)♡`);
|
|
1654
1666
|
return;
|
|
1655
1667
|
}
|
|
1656
1668
|
if (!await useLiveRoomInfo(LiveType.StopBroadcast) && !await useMasterInfo(LiveType.StopBroadcast)) {
|
|
1657
1669
|
liveStatus = false;
|
|
1658
|
-
await this.sendPrivateMsg("
|
|
1670
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,推送直播开播卡片也失败了,请主人帮女仆看看呀 (>ω<)♡");
|
|
1659
1671
|
return await this.sendPrivateMsgAndStopService();
|
|
1660
1672
|
}
|
|
1661
1673
|
liveStatus = false;
|
|
1662
|
-
this.logger.info(
|
|
1674
|
+
this.logger.info(`主人~女仆报告开播时粉丝数:${masterInfo.liveOpenFollowerNum},下播时粉丝数:${masterInfo.liveEndFollowerNum},粉丝数变化:${masterInfo.liveFollowerChange} 哦~女仆乖乖汇报完毕 (>ω<)♡`);
|
|
1663
1675
|
liveTime = liveRoomInfo?.live_time || luxon.DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1664
1676
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1665
1677
|
const followerChange = (() => {
|
|
@@ -1684,8 +1696,8 @@ var ComRegister = class ComRegister {
|
|
|
1684
1696
|
}
|
|
1685
1697
|
}
|
|
1686
1698
|
});
|
|
1687
|
-
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.sendPrivateMsg("
|
|
1688
|
-
this.logger.info(
|
|
1699
|
+
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.sendPrivateMsg("主人呜呜 (;>_<) 女仆获取直播间信息失败啦,所以启动直播间弹幕检测也失败了,请主人帮女仆看看呀 (>ω<)♡");
|
|
1700
|
+
this.logger.info(`主人~女仆查到当前粉丝数是:${masterInfo.liveOpenFollowerNum} 哦~乖乖报告完毕 (>ω<)♡`);
|
|
1689
1701
|
if (liveRoomInfo.live_status === 1) {
|
|
1690
1702
|
liveTime = liveRoomInfo.live_time;
|
|
1691
1703
|
const watched = liveData.watchedNum || "暂未获取到";
|
|
@@ -1754,7 +1766,7 @@ var ComRegister = class ComRegister {
|
|
|
1754
1766
|
}
|
|
1755
1767
|
return {
|
|
1756
1768
|
code: 0,
|
|
1757
|
-
message: "
|
|
1769
|
+
message: "主人~女仆发现这个分组已经存在啦 (>ω<)♡"
|
|
1758
1770
|
};
|
|
1759
1771
|
};
|
|
1760
1772
|
const resp = await checkGroupIsReady();
|
|
@@ -1776,7 +1788,7 @@ var ComRegister = class ComRegister {
|
|
|
1776
1788
|
}
|
|
1777
1789
|
return {
|
|
1778
1790
|
code: 0,
|
|
1779
|
-
message: "
|
|
1791
|
+
message: "主人~女仆获取分组明细成功啦~乖乖汇报完毕 (>ω<)♡",
|
|
1780
1792
|
data: relationGroupDetailData.data
|
|
1781
1793
|
};
|
|
1782
1794
|
};
|
|
@@ -1787,68 +1799,68 @@ var ComRegister = class ComRegister {
|
|
|
1787
1799
|
};
|
|
1788
1800
|
return {
|
|
1789
1801
|
code: 0,
|
|
1790
|
-
message: "
|
|
1802
|
+
message: "主人~女仆获取分组明细成功啦~乖乖汇报完毕 (>ω<)♡",
|
|
1791
1803
|
data
|
|
1792
1804
|
};
|
|
1793
1805
|
}
|
|
1794
1806
|
async subUserInBili(mid) {
|
|
1795
1807
|
for (const user of this.groupInfo) if (user.mid.toString() === mid) return {
|
|
1796
1808
|
code: 0,
|
|
1797
|
-
message: "
|
|
1809
|
+
message: "主人~女仆发现订阅对象已经在分组里啦 (>ω<)♡"
|
|
1798
1810
|
};
|
|
1799
1811
|
const subUserData = await this.ctx["bilibili-notify-api"].follow(mid);
|
|
1800
1812
|
return await ({
|
|
1801
1813
|
[-101]: () => {
|
|
1802
1814
|
return {
|
|
1803
1815
|
code: subUserData.code,
|
|
1804
|
-
message: "
|
|
1816
|
+
message: "主人呜呜 (;>_<) 女仆发现账号未登录哦~请主人使用指令 `bili login` 登录后再进行订阅操作呀 (>ω<)♡"
|
|
1805
1817
|
};
|
|
1806
1818
|
},
|
|
1807
1819
|
[-102]: () => {
|
|
1808
1820
|
return {
|
|
1809
1821
|
code: subUserData.code,
|
|
1810
|
-
message: "
|
|
1822
|
+
message: "主人呜呜 (;>_<) 女仆发现账号被封停啦,所以无法进行订阅操作呀 (>ω<)♡"
|
|
1811
1823
|
};
|
|
1812
1824
|
},
|
|
1813
1825
|
22002: () => {
|
|
1814
1826
|
return {
|
|
1815
1827
|
code: subUserData.code,
|
|
1816
|
-
message: "
|
|
1828
|
+
message: "主人呜呜 (;>_<) 女仆发现因为对方隐私设置,无法进行订阅操作呀 (>ω<)♡"
|
|
1817
1829
|
};
|
|
1818
1830
|
},
|
|
1819
1831
|
22003: () => {
|
|
1820
1832
|
return {
|
|
1821
1833
|
code: subUserData.code,
|
|
1822
|
-
message: "
|
|
1834
|
+
message: "主人呜呜 (;>_<) 女仆发现您已经把对方拉黑啦,所以无法进行订阅操作呀 (>ω<)♡"
|
|
1823
1835
|
};
|
|
1824
1836
|
},
|
|
1825
1837
|
22013: () => {
|
|
1826
1838
|
return {
|
|
1827
1839
|
code: subUserData.code,
|
|
1828
|
-
message: "
|
|
1840
|
+
message: "主人呜呜 (;>_<) 女仆发现账号已注销啦,所以无法进行订阅操作呀 (>ω<)♡"
|
|
1829
1841
|
};
|
|
1830
1842
|
},
|
|
1831
1843
|
40061: () => {
|
|
1832
1844
|
return {
|
|
1833
1845
|
code: subUserData.code,
|
|
1834
|
-
message: "
|
|
1846
|
+
message: "主人呜呜 (;>_<) 女仆发现账号不存在哦~请主人检查 UID 输入是否正确,或者用户是否真的存在呀 (>ω<)♡"
|
|
1835
1847
|
};
|
|
1836
1848
|
},
|
|
1837
1849
|
22001: () => {
|
|
1838
1850
|
return {
|
|
1839
1851
|
code: 0,
|
|
1840
|
-
message: "
|
|
1852
|
+
message: "主人~女仆发现订阅对象是主人自己呢~所以不用添加到分组啦 (>ω<)♡"
|
|
1841
1853
|
};
|
|
1842
1854
|
},
|
|
1843
1855
|
22014: async () => {
|
|
1844
1856
|
const copyUserToGroupData = await this.ctx["bilibili-notify-api"].copyUserToGroup(mid, this.loginDBData.dynamic_group_id);
|
|
1845
1857
|
if (copyUserToGroupData.code !== 0) return {
|
|
1846
1858
|
code: copyUserToGroupData.code,
|
|
1847
|
-
message: "
|
|
1859
|
+
message: "主人呜呜 (;>_<) 女仆尝试把订阅对象添加到分组失败啦~请主人稍后再试哦 (>ω<)♡"
|
|
1848
1860
|
};
|
|
1849
1861
|
return {
|
|
1850
1862
|
code: 0,
|
|
1851
|
-
message: "
|
|
1863
|
+
message: "主人~女仆已经成功把订阅对象添加到分组啦 (>ω<)♡"
|
|
1852
1864
|
};
|
|
1853
1865
|
},
|
|
1854
1866
|
22015: async () => {
|
|
@@ -1861,11 +1873,11 @@ var ComRegister = class ComRegister {
|
|
|
1861
1873
|
const copyUserToGroupData = await this.ctx["bilibili-notify-api"].copyUserToGroup(mid, this.loginDBData.dynamic_group_id);
|
|
1862
1874
|
if (copyUserToGroupData.code !== 0) return {
|
|
1863
1875
|
code: copyUserToGroupData.code,
|
|
1864
|
-
message: "
|
|
1876
|
+
message: "主人呜呜 (;>_<) 女仆尝试把订阅对象添加到分组失败啦~请主人稍后再试哦 (>ω<)♡"
|
|
1865
1877
|
};
|
|
1866
1878
|
return {
|
|
1867
1879
|
code: 0,
|
|
1868
|
-
message: "
|
|
1880
|
+
message: "主人~女仆已经成功把订阅对象添加到分组啦 (>ω<)♡"
|
|
1869
1881
|
};
|
|
1870
1882
|
}
|
|
1871
1883
|
}[subUserData.code] || (() => {
|
|
@@ -1878,10 +1890,10 @@ var ComRegister = class ComRegister {
|
|
|
1878
1890
|
async loadSubFromConfig(subs) {
|
|
1879
1891
|
this.preInitConfig(subs);
|
|
1880
1892
|
for (const sub of Object.values(subs)) {
|
|
1881
|
-
this.logger.info(
|
|
1893
|
+
this.logger.info(`主人~女仆正在加载订阅 UID:${sub.uid} 中呢~请稍等呀 (>ω<)♡`);
|
|
1882
1894
|
const subInfo = await this.subUserInBili(sub.uid);
|
|
1883
1895
|
if (subInfo.code !== 0 && subInfo.code !== 22015) return subInfo;
|
|
1884
|
-
if (subInfo.code === 22015) this.logger.warn(
|
|
1896
|
+
if (subInfo.code === 22015) this.logger.warn(`主人呜呜 (;>_<) 女仆发现账号异常,无法自动订阅 UID:${sub.uid} 哦~请主人手动订阅,然后把订阅移动到 "订阅" 分组里呀 (>ω<)♡`);
|
|
1885
1897
|
this.subManager.set(sub.uid, {
|
|
1886
1898
|
uname: sub.uname,
|
|
1887
1899
|
roomId: sub.roomid,
|
|
@@ -1893,19 +1905,19 @@ var ComRegister = class ComRegister {
|
|
|
1893
1905
|
customLiveSummary: sub.customLiveSummary
|
|
1894
1906
|
});
|
|
1895
1907
|
if (sub.live && !sub.roomid) {
|
|
1896
|
-
this.logger.info(
|
|
1908
|
+
this.logger.info(`主人~女仆发现 UID:${sub.uid} 请求了用户接口哦~女仆乖乖记录啦 (>ω<)♡`);
|
|
1897
1909
|
const { code: userInfoCode, message: userInfoMsg, data: userInfoData } = await withRetry(async () => {
|
|
1898
1910
|
return await this.ctx["bilibili-notify-api"].getUserInfo(sub.uid);
|
|
1899
1911
|
}).catch((e) => {
|
|
1900
|
-
this.logger.error(
|
|
1912
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 loadSubFromConfig() 的 getUserInfo() 时发生错误啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
1901
1913
|
return {
|
|
1902
1914
|
code: -1,
|
|
1903
|
-
message:
|
|
1915
|
+
message: `主人呜呜 (;>_<) 女仆加载订阅 UID:${sub.uid} 失败啦~请主人帮女仆看看呀 (>ω<)♡`
|
|
1904
1916
|
};
|
|
1905
1917
|
});
|
|
1906
1918
|
if (userInfoCode === -352 && userInfoData.v_voucher) {
|
|
1907
|
-
this.logger.info("
|
|
1908
|
-
await this.sendPrivateMsg("
|
|
1919
|
+
this.logger.info("主人呜呜 (;>_<) 女仆发现账号被风控啦~请主人使用指令 `bili cap` 进行风控验证呀 (>ω<)♡");
|
|
1920
|
+
await this.sendPrivateMsg("主人呜呜 (;>_<) 女仆发现账号被风控啦~请主人使用指令 `bili cap` 进行风控验证呀 (>ω<)♡");
|
|
1909
1921
|
return {
|
|
1910
1922
|
code: userInfoCode,
|
|
1911
1923
|
message: userInfoMsg
|
|
@@ -1917,21 +1929,21 @@ var ComRegister = class ComRegister {
|
|
|
1917
1929
|
};
|
|
1918
1930
|
if (sub.live && !userInfoData.live_room) {
|
|
1919
1931
|
sub.live = false;
|
|
1920
|
-
this.logger.warn(
|
|
1932
|
+
this.logger.warn(`主人~女仆发现 UID:${sub.uid} 的用户没有开通直播间哦,所以无法订阅直播啦 (>ω<)♡`);
|
|
1921
1933
|
}
|
|
1922
1934
|
sub.roomid = userInfoData.live_room?.roomid;
|
|
1923
1935
|
}
|
|
1924
1936
|
if (sub.live && sub.roomid) await this.liveDetectWithListener(sub);
|
|
1925
|
-
this.logger.info(
|
|
1937
|
+
this.logger.info(`主人~女仆订阅 UID:${sub.uid} 已经加载完毕啦~乖乖完成任务啦 (>ω<)♡`);
|
|
1926
1938
|
if (sub !== Object.values(subs).pop()) {
|
|
1927
1939
|
const randomDelay = Math.floor(Math.random() * 3) + 1;
|
|
1928
|
-
this.logger.info(
|
|
1940
|
+
this.logger.info(`主人~女仆设置了随机延迟哦~延迟时间:${randomDelay} 秒呢 (>ω<)♡`);
|
|
1929
1941
|
await this.ctx.sleep(randomDelay * 1e3);
|
|
1930
1942
|
}
|
|
1931
1943
|
}
|
|
1932
1944
|
return {
|
|
1933
1945
|
code: 0,
|
|
1934
|
-
message: "
|
|
1946
|
+
message: "主人~女仆的订阅加载完毕啦!乖乖完成任务~(>ω<)♡"
|
|
1935
1947
|
};
|
|
1936
1948
|
}
|
|
1937
1949
|
checkIfDynamicDetectIsNeeded() {
|
|
@@ -1939,7 +1951,7 @@ var ComRegister = class ComRegister {
|
|
|
1939
1951
|
}
|
|
1940
1952
|
enableDynamicDetect() {
|
|
1941
1953
|
this.dynamicJob = new cron.CronJob(this.config.dynamicCron, this.config.dynamicDebugMode ? this.debug_dynamicDetect() : this.dynamicDetect());
|
|
1942
|
-
this.logger.info("
|
|
1954
|
+
this.logger.info("主人~女仆的动态监测已经开启啦~开始乖乖监控动态呢 (>ω<)♡");
|
|
1943
1955
|
this.dynamicJob.start();
|
|
1944
1956
|
}
|
|
1945
1957
|
async checkIfIsLogin() {
|
|
@@ -3822,7 +3834,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3822
3834
|
this.wbiSign.img_key = ticket.data.nav.img.slice(ticket.data.nav.img.lastIndexOf("/") + 1, ticket.data.nav.img.lastIndexOf("."));
|
|
3823
3835
|
this.wbiSign.sub_key = ticket.data.nav.sub.slice(ticket.data.nav.sub.lastIndexOf("/") + 1, ticket.data.nav.sub.lastIndexOf("."));
|
|
3824
3836
|
} catch (e) {
|
|
3825
|
-
this.logger.error(
|
|
3837
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆更新 BiliTicket 失败啦~错误信息:${e.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3826
3838
|
}
|
|
3827
3839
|
}
|
|
3828
3840
|
getMixinKey = (orig) => mixinKeyEncTab.map((n) => orig[n]).join("").slice(0, 32);
|
|
@@ -3863,7 +3875,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3863
3875
|
};
|
|
3864
3876
|
return await this.pRetry(run, {
|
|
3865
3877
|
onFailedAttempt: (error) => {
|
|
3866
|
-
this.logger.error(
|
|
3878
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTheUserWhoIsLiveStreaming() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3867
3879
|
},
|
|
3868
3880
|
retries: 3
|
|
3869
3881
|
});
|
|
@@ -3875,7 +3887,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3875
3887
|
};
|
|
3876
3888
|
return await this.pRetry(run, {
|
|
3877
3889
|
onFailedAttempt: (error) => {
|
|
3878
|
-
this.logger.error(
|
|
3890
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoStreamKey() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3879
3891
|
},
|
|
3880
3892
|
retries: 3
|
|
3881
3893
|
});
|
|
@@ -3888,7 +3900,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3888
3900
|
};
|
|
3889
3901
|
return await this.pRetry(run, {
|
|
3890
3902
|
onFailedAttempt: (error) => {
|
|
3891
|
-
this.logger.error(
|
|
3903
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoByUids() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3892
3904
|
},
|
|
3893
3905
|
retries: 3
|
|
3894
3906
|
});
|
|
@@ -3902,7 +3914,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3902
3914
|
};
|
|
3903
3915
|
return await this.pRetry(run, {
|
|
3904
3916
|
onFailedAttempt: (error) => {
|
|
3905
|
-
this.logger.error(
|
|
3917
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getServerUTCTime() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3906
3918
|
},
|
|
3907
3919
|
retries: 3
|
|
3908
3920
|
});
|
|
@@ -3914,7 +3926,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3914
3926
|
};
|
|
3915
3927
|
return await this.pRetry(run, {
|
|
3916
3928
|
onFailedAttempt: (error) => {
|
|
3917
|
-
this.logger.error(
|
|
3929
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTimeNow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3918
3930
|
},
|
|
3919
3931
|
retries: 3
|
|
3920
3932
|
});
|
|
@@ -3926,7 +3938,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3926
3938
|
};
|
|
3927
3939
|
return await this.pRetry(run, {
|
|
3928
3940
|
onFailedAttempt: (error) => {
|
|
3929
|
-
this.logger.error(
|
|
3941
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3930
3942
|
},
|
|
3931
3943
|
retries: 3
|
|
3932
3944
|
});
|
|
@@ -3943,7 +3955,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3943
3955
|
};
|
|
3944
3956
|
return await this.pRetry(run, {
|
|
3945
3957
|
onFailedAttempt: (error) => {
|
|
3946
|
-
this.logger.error(
|
|
3958
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 removeUserFromGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3947
3959
|
},
|
|
3948
3960
|
retries: 3
|
|
3949
3961
|
});
|
|
@@ -3960,7 +3972,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3960
3972
|
};
|
|
3961
3973
|
return await this.pRetry(run, {
|
|
3962
3974
|
onFailedAttempt: (error) => {
|
|
3963
|
-
this.logger.error(
|
|
3975
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 copyUserToGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3964
3976
|
},
|
|
3965
3977
|
retries: 3
|
|
3966
3978
|
});
|
|
@@ -3972,7 +3984,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3972
3984
|
};
|
|
3973
3985
|
return await this.pRetry(run, {
|
|
3974
3986
|
onFailedAttempt: (error) => {
|
|
3975
|
-
this.logger.error(
|
|
3987
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserSpaceDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3976
3988
|
},
|
|
3977
3989
|
retries: 3
|
|
3978
3990
|
});
|
|
@@ -3987,7 +3999,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3987
3999
|
};
|
|
3988
4000
|
return await this.pRetry(run, {
|
|
3989
4001
|
onFailedAttempt: (error) => {
|
|
3990
|
-
this.logger.error(
|
|
4002
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 createGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3991
4003
|
},
|
|
3992
4004
|
retries: 3
|
|
3993
4005
|
});
|
|
@@ -3999,7 +4011,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3999
4011
|
};
|
|
4000
4012
|
return await this.pRetry(run, {
|
|
4001
4013
|
onFailedAttempt: (error) => {
|
|
4002
|
-
this.logger.error(
|
|
4014
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4003
4015
|
},
|
|
4004
4016
|
retries: 3
|
|
4005
4017
|
});
|
|
@@ -4011,7 +4023,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4011
4023
|
};
|
|
4012
4024
|
return await this.pRetry(run, {
|
|
4013
4025
|
onFailedAttempt: (error) => {
|
|
4014
|
-
this.logger.error(
|
|
4026
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 hasNewDynamic()时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4015
4027
|
},
|
|
4016
4028
|
retries: 3
|
|
4017
4029
|
});
|
|
@@ -4028,7 +4040,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4028
4040
|
};
|
|
4029
4041
|
return await this.pRetry(run, {
|
|
4030
4042
|
onFailedAttempt: (error) => {
|
|
4031
|
-
this.logger.error(
|
|
4043
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 follow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4032
4044
|
},
|
|
4033
4045
|
retries: 3
|
|
4034
4046
|
});
|
|
@@ -4040,7 +4052,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4040
4052
|
};
|
|
4041
4053
|
return await this.pRetry(run, {
|
|
4042
4054
|
onFailedAttempt: (error) => {
|
|
4043
|
-
this.logger.error(
|
|
4055
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getRelationGroupDetail() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4044
4056
|
},
|
|
4045
4057
|
retries: 3
|
|
4046
4058
|
});
|
|
@@ -4055,7 +4067,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4055
4067
|
};
|
|
4056
4068
|
return await this.pRetry(run, {
|
|
4057
4069
|
onFailedAttempt: (error) => {
|
|
4058
|
-
this.logger.error(
|
|
4070
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getCookieInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4059
4071
|
},
|
|
4060
4072
|
retries: 3
|
|
4061
4073
|
});
|
|
@@ -4074,7 +4086,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4074
4086
|
};
|
|
4075
4087
|
return await this.pRetry(run, {
|
|
4076
4088
|
onFailedAttempt: (error) => {
|
|
4077
|
-
this.logger.error(
|
|
4089
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4078
4090
|
},
|
|
4079
4091
|
retries: 3
|
|
4080
4092
|
});
|
|
@@ -4090,7 +4102,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4090
4102
|
};
|
|
4091
4103
|
return await this.pRetry(run, {
|
|
4092
4104
|
onFailedAttempt: (error) => {
|
|
4093
|
-
this.logger.error(
|
|
4105
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getWbiKeys() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4094
4106
|
},
|
|
4095
4107
|
retries: 3
|
|
4096
4108
|
});
|
|
@@ -4102,7 +4114,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4102
4114
|
};
|
|
4103
4115
|
return await this.pRetry(run, {
|
|
4104
4116
|
onFailedAttempt: (error) => {
|
|
4105
|
-
this.logger.error(
|
|
4117
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMyselfInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4106
4118
|
},
|
|
4107
4119
|
retries: 3
|
|
4108
4120
|
});
|
|
@@ -4114,7 +4126,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4114
4126
|
};
|
|
4115
4127
|
return await this.pRetry(run, {
|
|
4116
4128
|
onFailedAttempt: (error) => {
|
|
4117
|
-
this.logger.error(
|
|
4129
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginQRCode() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4118
4130
|
},
|
|
4119
4131
|
retries: 3
|
|
4120
4132
|
});
|
|
@@ -4126,7 +4138,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4126
4138
|
};
|
|
4127
4139
|
return await this.pRetry(run, {
|
|
4128
4140
|
onFailedAttempt: (error) => {
|
|
4129
|
-
this.logger.error(
|
|
4141
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginStatus() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4130
4142
|
},
|
|
4131
4143
|
retries: 3
|
|
4132
4144
|
});
|
|
@@ -4138,7 +4150,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4138
4150
|
};
|
|
4139
4151
|
return await this.pRetry(run, {
|
|
4140
4152
|
onFailedAttempt: (error) => {
|
|
4141
|
-
this.logger.error(
|
|
4153
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4142
4154
|
},
|
|
4143
4155
|
retries: 3
|
|
4144
4156
|
});
|
|
@@ -4150,7 +4162,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4150
4162
|
};
|
|
4151
4163
|
return await this.pRetry(run, {
|
|
4152
4164
|
onFailedAttempt: (error) => {
|
|
4153
|
-
this.logger.error(
|
|
4165
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMasterInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4154
4166
|
},
|
|
4155
4167
|
retries: 3
|
|
4156
4168
|
});
|
|
@@ -4162,7 +4174,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4162
4174
|
};
|
|
4163
4175
|
return await this.pRetry(run, {
|
|
4164
4176
|
onFailedAttempt: (error) => {
|
|
4165
|
-
this.logger.error(
|
|
4177
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getOnlineGoldRank() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4166
4178
|
},
|
|
4167
4179
|
retries: 3
|
|
4168
4180
|
});
|
|
@@ -4174,7 +4186,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4174
4186
|
};
|
|
4175
4187
|
return await this.pRetry(run, {
|
|
4176
4188
|
onFailedAttempt: (error) => {
|
|
4177
|
-
this.logger.error(
|
|
4189
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4178
4190
|
},
|
|
4179
4191
|
retries: 3
|
|
4180
4192
|
});
|
|
@@ -4188,7 +4200,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4188
4200
|
};
|
|
4189
4201
|
return await this.pRetry(run, {
|
|
4190
4202
|
onFailedAttempt: (error) => {
|
|
4191
|
-
this.logger.error(
|
|
4203
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4192
4204
|
},
|
|
4193
4205
|
retries: 3
|
|
4194
4206
|
});
|
|
@@ -4200,7 +4212,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4200
4212
|
};
|
|
4201
4213
|
return await this.pRetry(run, {
|
|
4202
4214
|
onFailedAttempt: (error) => {
|
|
4203
|
-
this.logger.error(
|
|
4215
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4204
4216
|
},
|
|
4205
4217
|
retries: 3
|
|
4206
4218
|
});
|
|
@@ -4277,7 +4289,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4277
4289
|
baseURL: this.apiConfig.ai.baseURL,
|
|
4278
4290
|
apiKey: this.apiConfig.ai.apiKey
|
|
4279
4291
|
});
|
|
4280
|
-
this.logger.info("AI
|
|
4292
|
+
this.logger.info("主人~女仆的 AI 客户端创建成功啦~乖乖准备好为主人服务呢 (>ω<)♡");
|
|
4281
4293
|
}
|
|
4282
4294
|
}
|
|
4283
4295
|
addCookie(cookieStr) {
|
|
@@ -4484,7 +4496,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4484
4496
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } }).catch((e) => {
|
|
4485
4497
|
this.logger.error(e);
|
|
4486
4498
|
});
|
|
4487
|
-
if (data.code !== 0) this.logger.error("
|
|
4499
|
+
if (data.code !== 0) this.logger.error("主人呜呜 (;>_<) 女仆获取验证码失败啦,请主人再试一次呀 (>ω<)♡");
|
|
4488
4500
|
return { data: data.data };
|
|
4489
4501
|
}
|
|
4490
4502
|
async validateCaptcha(challenge, token, validate, seccode) {
|
|
@@ -4497,7 +4509,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4497
4509
|
seccode
|
|
4498
4510
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
4499
4511
|
if (data.code !== 0) {
|
|
4500
|
-
this.logger.info(
|
|
4512
|
+
this.logger.info(`主人呜呜 (;>_<) 验证失败啦~错误码=${data.code},错误消息:${data.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4501
4513
|
return { data: null };
|
|
4502
4514
|
}
|
|
4503
4515
|
this.addCookie(`x-bili-gaia-vtoken=${data.data.grisk_id}`);
|
|
@@ -4532,26 +4544,30 @@ var BLive = class extends koishi.Service {
|
|
|
4532
4544
|
}
|
|
4533
4545
|
async startLiveRoomListener(roomId, handler) {
|
|
4534
4546
|
if (this.listenerRecord[roomId]) {
|
|
4535
|
-
this.logger.warn(
|
|
4547
|
+
this.logger.warn(`主人~女仆发现 [${roomId}] 直播间连接已经存在啦,不能重复创建哦 (>ω<)♡`);
|
|
4536
4548
|
return;
|
|
4537
4549
|
}
|
|
4538
4550
|
const cookiesStr = await this.ctx["bilibili-notify-api"].getCookiesForHeader();
|
|
4539
4551
|
const mySelfInfo = await this.ctx["bilibili-notify-api"].getMyselfInfo();
|
|
4540
|
-
|
|
4552
|
+
if (mySelfInfo.code !== 0) {
|
|
4553
|
+
this.logger.warn(`主人~女仆获取个人信息失败啦~无法创建 [${roomId}] 直播间连接呢~请主人帮女仆看看呀 (>ω<)♡`);
|
|
4554
|
+
return;
|
|
4555
|
+
}
|
|
4556
|
+
this.listenerRecord[roomId] = (0, blive_message_listener.startListen)(Number.parseInt(roomId, 10), handler, { ws: {
|
|
4541
4557
|
headers: { Cookie: cookiesStr },
|
|
4542
4558
|
uid: mySelfInfo.data.mid
|
|
4543
4559
|
} });
|
|
4544
|
-
this.logger.info(
|
|
4560
|
+
this.logger.info(`主人~女仆成功建立了 [${roomId}] 直播间连接啦~乖乖完成任务呢 (>ω<)♡`);
|
|
4545
4561
|
}
|
|
4546
4562
|
closeListener(roomId) {
|
|
4547
|
-
if (!this.listenerRecord || !this.listenerRecord[roomId]?.closed) this.logger.info(
|
|
4563
|
+
if (!this.listenerRecord || !this.listenerRecord[roomId]?.closed) this.logger.info(`主人~女仆发现 ${roomId} 直播间连接不需要关闭哦 (>ω<)♡`);
|
|
4548
4564
|
this.listenerRecord[roomId].close();
|
|
4549
4565
|
if (this.listenerRecord[roomId].closed) {
|
|
4550
4566
|
delete this.listenerRecord[roomId];
|
|
4551
|
-
this.logger.info(
|
|
4567
|
+
this.logger.info(`主人~女仆已经关闭了 ${roomId} 直播间连接啦 (>ω<)♡`);
|
|
4552
4568
|
return;
|
|
4553
4569
|
}
|
|
4554
|
-
this.logger.warn(
|
|
4570
|
+
this.logger.warn(`主人呜呜 (;>_<) 女仆尝试关闭 ${roomId} 直播间连接失败啦~请主人帮女仆看看呀 (>ω<)♡`);
|
|
4555
4571
|
}
|
|
4556
4572
|
clearListeners() {
|
|
4557
4573
|
for (const key of Object.keys(this.listenerRecord)) {
|
|
@@ -4577,14 +4593,25 @@ const usage = `
|
|
|
4577
4593
|
|
|
4578
4594
|
---
|
|
4579
4595
|
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4596
|
+
主人好呀~我是笨笨女仆小助手哒 (〃∀〃)♡
|
|
4597
|
+
专门帮主人管理 B 站订阅和直播推送的!
|
|
4598
|
+
女仆虽然笨笨的,但是会尽力不出错哦~
|
|
4599
|
+
主人,只要按照女仆的提示一步一步设置,女仆就可以乖乖帮您工作啦!
|
|
4600
|
+
|
|
4601
|
+
首先呢~请主人仔细阅读订阅相关的 subs 的填写说明 (>ω<)b
|
|
4602
|
+
【主人账号部分非必填】然后再告诉女仆您的 主人账号 (///▽///),并选择您希望女仆服务的平台~
|
|
4603
|
+
接着,请认真填写 主人的 ID 和 群组 ID,确保信息完全正确~
|
|
4604
|
+
这样女仆才能顺利找到您并准确汇报动态呢 (≧▽≦)
|
|
4605
|
+
|
|
4606
|
+
不用着急,女仆会一直在这里陪着您,一步一步完成设置~
|
|
4607
|
+
主人只要乖乖填好这些信息,就能让女仆变得超级听话、超级勤快啦 (>///<)♡
|
|
4608
|
+
|
|
4609
|
+
主人~注意事项要仔细看呀 (>_<)♡
|
|
4610
|
+
- 如果主人使用的是 onebot 机器人,平台名请填写 onebot,而不是 qq 哦~
|
|
4611
|
+
- 同样的呀,如果是 onebot 机器人,请务必填写 onebot,不要写成 qq 哦~
|
|
4612
|
+
- 女仆再提醒一次~onebot 机器人就填 onebot,千万不要写 qq 哦~
|
|
4583
4613
|
|
|
4584
|
-
|
|
4585
|
-
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4586
|
-
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4587
|
-
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4614
|
+
乖乖遵守这些规则,女仆才能顺利帮主人工作呢 (*>ω<)b
|
|
4588
4615
|
|
|
4589
4616
|
---
|
|
4590
4617
|
`;
|
|
@@ -4595,23 +4622,20 @@ var ServerManager = class extends koishi.Service {
|
|
|
4595
4622
|
super(ctx, "bilibili-notify");
|
|
4596
4623
|
const sysCom = ctx.command("bn", "bilibili-notify 插件运行相关指令", { permissions: ["authority:5"] });
|
|
4597
4624
|
sysCom.subcommand(".restart", "重启插件").usage("重启插件").example("bn restart").action(async () => {
|
|
4598
|
-
this.
|
|
4599
|
-
|
|
4600
|
-
return "插件重启失败";
|
|
4625
|
+
if (await this.restartPlugin()) return "主人~女仆成功重启插件啦~乖乖继续为主人服务呢 (>ω<)♡";
|
|
4626
|
+
return "主人呜呜 (;>_<) 女仆重启插件失败啦~请主人检查一下再试哦 (>ω<)♡";
|
|
4601
4627
|
});
|
|
4602
4628
|
sysCom.subcommand(".stop", "停止插件").usage("停止插件").example("bn stop").action(async () => {
|
|
4603
|
-
this.
|
|
4604
|
-
|
|
4605
|
-
return "停止插件失败";
|
|
4629
|
+
if (await this.disposePlugin()) return "主人~女仆已经停止插件啦~休息一下先 (>ω<)♡";
|
|
4630
|
+
return "主人呜呜 (;>_<) 女仆停止插件失败啦~请主人检查一下再试哦 (>ω<)♡";
|
|
4606
4631
|
});
|
|
4607
4632
|
sysCom.subcommand(".start", "启动插件").usage("启动插件").example("bn start").action(async () => {
|
|
4608
|
-
this.
|
|
4609
|
-
|
|
4610
|
-
return "插件启动失败";
|
|
4633
|
+
if (await this.registerPlugin()) return "主人~女仆成功启动插件啦~准备好乖乖为主人工作呢 (>ω<)♡";
|
|
4634
|
+
return "主人呜呜 (;>_<) 女仆启动插件失败啦~请主人检查一下再试哦 (>ω<)♡";
|
|
4611
4635
|
});
|
|
4612
4636
|
}
|
|
4613
4637
|
start() {
|
|
4614
|
-
if (!this.registerPlugin()) this.logger.error("
|
|
4638
|
+
if (!this.registerPlugin()) this.logger.error("主人呜呜 (;>_<) 女仆启动插件失败啦~请主人检查一下再试哦 (>ω<)♡");
|
|
4615
4639
|
}
|
|
4616
4640
|
registerPlugin = () => {
|
|
4617
4641
|
if (this.servers.length !== 0) return false;
|
|
@@ -4659,7 +4683,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4659
4683
|
this.servers.push(gi);
|
|
4660
4684
|
this.servers.push(cr);
|
|
4661
4685
|
} catch (e) {
|
|
4662
|
-
this.logger.error(
|
|
4686
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆注册插件失败啦~错误信息:${e},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4663
4687
|
return false;
|
|
4664
4688
|
}
|
|
4665
4689
|
return true;
|
|
@@ -4675,7 +4699,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4675
4699
|
};
|
|
4676
4700
|
restartPlugin = async () => {
|
|
4677
4701
|
if (this.servers.length === 0) {
|
|
4678
|
-
this.logger.warn("
|
|
4702
|
+
this.logger.warn("主人~女仆发现插件目前没有运行哦~请主人使用指令 bn start 启动插件呀 (>ω<)♡");
|
|
4679
4703
|
return false;
|
|
4680
4704
|
}
|
|
4681
4705
|
await this.disposePlugin();
|
|
@@ -4684,7 +4708,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4684
4708
|
try {
|
|
4685
4709
|
this.registerPlugin();
|
|
4686
4710
|
} catch (e) {
|
|
4687
|
-
this.logger.error(
|
|
4711
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆重启插件失败啦~错误信息:${e},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4688
4712
|
resolve$2(false);
|
|
4689
4713
|
}
|
|
4690
4714
|
resolve$2(true);
|