koishi-plugin-bilibili-notify 3.3.8-alpha.1 → 3.3.8
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.js +5 -5
- package/lib/index.mjs +5 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -867,7 +867,7 @@ var ComRegister$1 = class {
|
|
|
867
867
|
this.logger.info("初始化推送群组/频道信息:");
|
|
868
868
|
this.logger.info(this.pushArrMap);
|
|
869
869
|
}
|
|
870
|
-
async pushMessage(targets, content
|
|
870
|
+
async pushMessage(targets, content) {
|
|
871
871
|
const t = {};
|
|
872
872
|
for (const target of targets) {
|
|
873
873
|
const [platform, channleId] = target.split(":");
|
|
@@ -878,20 +878,20 @@ var ComRegister$1 = class {
|
|
|
878
878
|
const bots = [];
|
|
879
879
|
for (const bot of this.ctx.bots) if (bot.platform === platform) bots.push(bot);
|
|
880
880
|
let num = 0;
|
|
881
|
-
const sendMessageByBot = async (channelId, botIndex = 0) => {
|
|
881
|
+
const sendMessageByBot = async (channelId, botIndex = 0, retry = 3e3) => {
|
|
882
882
|
if (!bots[botIndex]) {
|
|
883
883
|
this.logger.warn(`${platform} 没有配置对应机器人,无法进行推送!`);
|
|
884
884
|
return;
|
|
885
885
|
}
|
|
886
886
|
if (bots[botIndex].status !== koishi.Universal.Status.ONLINE) {
|
|
887
|
-
if (retry >= 3e3 * 2
|
|
887
|
+
if (retry >= 3e3 * 2 ** 5) {
|
|
888
888
|
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
889
889
|
await this.sendPrivateMsg(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
890
890
|
return;
|
|
891
891
|
}
|
|
892
892
|
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,${retry / 1e3}秒后重试`);
|
|
893
893
|
await this.ctx.sleep(retry);
|
|
894
|
-
await
|
|
894
|
+
await sendMessageByBot(channelId, botIndex, retry * 2);
|
|
895
895
|
return;
|
|
896
896
|
}
|
|
897
897
|
try {
|
|
@@ -1373,7 +1373,7 @@ var ComRegister$1 = class {
|
|
|
1373
1373
|
liveTime = liveRoomInfo.live_time;
|
|
1374
1374
|
const watched = watchedNum || "暂未获取到";
|
|
1375
1375
|
const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1376
|
-
if (this.config.restartPush)
|
|
1376
|
+
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
|
|
1377
1377
|
liveRoomInfo,
|
|
1378
1378
|
masterInfo,
|
|
1379
1379
|
cardStyle: sub.customCardStyle
|
package/lib/index.mjs
CHANGED
|
@@ -849,7 +849,7 @@ var ComRegister$1 = class {
|
|
|
849
849
|
this.logger.info("初始化推送群组/频道信息:");
|
|
850
850
|
this.logger.info(this.pushArrMap);
|
|
851
851
|
}
|
|
852
|
-
async pushMessage(targets, content
|
|
852
|
+
async pushMessage(targets, content) {
|
|
853
853
|
const t = {};
|
|
854
854
|
for (const target of targets) {
|
|
855
855
|
const [platform, channleId] = target.split(":");
|
|
@@ -860,20 +860,20 @@ var ComRegister$1 = class {
|
|
|
860
860
|
const bots = [];
|
|
861
861
|
for (const bot of this.ctx.bots) if (bot.platform === platform) bots.push(bot);
|
|
862
862
|
let num = 0;
|
|
863
|
-
const sendMessageByBot = async (channelId, botIndex = 0) => {
|
|
863
|
+
const sendMessageByBot = async (channelId, botIndex = 0, retry = 3e3) => {
|
|
864
864
|
if (!bots[botIndex]) {
|
|
865
865
|
this.logger.warn(`${platform} 没有配置对应机器人,无法进行推送!`);
|
|
866
866
|
return;
|
|
867
867
|
}
|
|
868
868
|
if (bots[botIndex].status !== Universal.Status.ONLINE) {
|
|
869
|
-
if (retry >= 3e3 * 2
|
|
869
|
+
if (retry >= 3e3 * 2 ** 5) {
|
|
870
870
|
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
871
871
|
await this.sendPrivateMsg(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
872
872
|
return;
|
|
873
873
|
}
|
|
874
874
|
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,${retry / 1e3}秒后重试`);
|
|
875
875
|
await this.ctx.sleep(retry);
|
|
876
|
-
await
|
|
876
|
+
await sendMessageByBot(channelId, botIndex, retry * 2);
|
|
877
877
|
return;
|
|
878
878
|
}
|
|
879
879
|
try {
|
|
@@ -1355,7 +1355,7 @@ var ComRegister$1 = class {
|
|
|
1355
1355
|
liveTime = liveRoomInfo.live_time;
|
|
1356
1356
|
const watched = watchedNum || "暂未获取到";
|
|
1357
1357
|
const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1358
|
-
if (this.config.restartPush)
|
|
1358
|
+
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
|
|
1359
1359
|
liveRoomInfo,
|
|
1360
1360
|
masterInfo,
|
|
1361
1361
|
cardStyle: sub.customCardStyle
|