koishi-plugin-bilibili-notify 2.0.0-alpha.18 → 2.0.0-alpha.19
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/comRegister.js +7 -7
- package/lib/generateImg.js +1 -1
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/comRegister.js
CHANGED
|
@@ -677,7 +677,7 @@ class ComRegister {
|
|
|
677
677
|
for (const channel of sendArr) {
|
|
678
678
|
// 判断是否需要推送直播消息
|
|
679
679
|
if (channel.live) {
|
|
680
|
-
await this.sendMsgFunc(bot, channel.channelId, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [content, channel.atAll
|
|
680
|
+
await this.sendMsgFunc(bot, channel.channelId, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [content, channel.atAll ? (0, jsx_runtime_1.jsx)("at", { type: "all" }) : null] }));
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
683
|
}
|
|
@@ -1082,7 +1082,7 @@ class ComRegister {
|
|
|
1082
1082
|
// 推送直播信息
|
|
1083
1083
|
// pic 存在,使用的是render模式
|
|
1084
1084
|
if (pic) {
|
|
1085
|
-
const msg = liveNotifyMsg
|
|
1085
|
+
const msg = liveNotifyMsg || '';
|
|
1086
1086
|
// 只有在开播时才艾特全体成员
|
|
1087
1087
|
if (liveType === LiveType.StartBroadcasting) {
|
|
1088
1088
|
return await this.sendMsg(ctx, target, pic + msg, true);
|
|
@@ -1091,7 +1091,7 @@ class ComRegister {
|
|
|
1091
1091
|
return await this.sendMsg(ctx, target, pic + msg);
|
|
1092
1092
|
}
|
|
1093
1093
|
// pic不存在,说明使用的是page模式
|
|
1094
|
-
const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), liveNotifyMsg
|
|
1094
|
+
const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), liveNotifyMsg || ''] });
|
|
1095
1095
|
// 只有在开播时才艾特全体成员
|
|
1096
1096
|
if (liveType === LiveType.StartBroadcasting) {
|
|
1097
1097
|
return await this.sendMsg(ctx, target, msg, true);
|
|
@@ -1188,9 +1188,9 @@ class ComRegister {
|
|
|
1188
1188
|
// 下播了将定时器清零
|
|
1189
1189
|
timer = 0;
|
|
1190
1190
|
// 定义下播通知消息
|
|
1191
|
-
const liveEndMsg = this.config.customLiveEnd
|
|
1191
|
+
const liveEndMsg = this.config.customLiveEnd ? this.config.customLiveEnd
|
|
1192
1192
|
.replace('-name', username)
|
|
1193
|
-
.replace('-time', await ctx.gi.getTimeDifference(liveTime));
|
|
1193
|
+
.replace('-time', await ctx.gi.getTimeDifference(liveTime)) : null;
|
|
1194
1194
|
// 更改直播时长
|
|
1195
1195
|
data.live_time = liveTime;
|
|
1196
1196
|
// 发送@全体成员通知
|
|
@@ -1224,10 +1224,10 @@ class ComRegister {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
1226
|
// 定义开播通知语
|
|
1227
|
-
const liveStartMsg = this.config.customLiveStart
|
|
1227
|
+
const liveStartMsg = this.config.customLiveStart ? this.config.customLiveStart
|
|
1228
1228
|
.replace('-name', username)
|
|
1229
1229
|
.replace('-time', await ctx.gi.getTimeDifference(liveTime))
|
|
1230
|
-
.replace('-link', `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`);
|
|
1230
|
+
.replace('-link', `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`) : null;
|
|
1231
1231
|
// 发送消息
|
|
1232
1232
|
await sendLiveNotifyCard(data, LiveType.StartBroadcasting, liveStartMsg);
|
|
1233
1233
|
}
|
package/lib/generateImg.js
CHANGED
|
@@ -176,7 +176,7 @@ class GenerateImg extends koishi_1.Service {
|
|
|
176
176
|
</div>
|
|
177
177
|
${this.giConfig.hideDesc ? '' : `<p class="card-text">${data.description ? data.description : '这个主播很懒,什么都简介都没写'}</p>`}
|
|
178
178
|
<p class="card-link">
|
|
179
|
-
${liveStatus !== 3
|
|
179
|
+
${liveStatus !== 3 ? `<span>人气:${data.online > 10000 ? `${(data.online / 10000).toFixed(1)}万` : data.online}</span>` : null}
|
|
180
180
|
<span>分区名称:${data.area_name}</span>
|
|
181
181
|
</p>
|
|
182
182
|
<p class="card-link">
|
package/package.json
CHANGED