koishi-plugin-bilibili-notify 3.3.8-alpha.0 → 3.3.8-alpha.2
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 +9 -5
- package/lib/index.mjs +9 -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,16 +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 ** 5) {
|
|
888
|
+
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
889
|
+
await this.sendPrivateMsg(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
887
892
|
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,${retry / 1e3}秒后重试`);
|
|
888
|
-
this.ctx.
|
|
889
|
-
|
|
890
|
-
}, retry);
|
|
893
|
+
await this.ctx.sleep(retry);
|
|
894
|
+
await sendMessageByBot(channelId, botIndex, retry * 2);
|
|
891
895
|
return;
|
|
892
896
|
}
|
|
893
897
|
try {
|
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,16 +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 ** 5) {
|
|
870
|
+
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
871
|
+
await this.sendPrivateMsg(`${platform} 机器人未初始化完毕,无法进行推送,已重试5次,放弃推送`);
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
869
874
|
this.logger.error(`${platform} 机器人未初始化完毕,无法进行推送,${retry / 1e3}秒后重试`);
|
|
870
|
-
this.ctx.
|
|
871
|
-
|
|
872
|
-
}, retry);
|
|
875
|
+
await this.ctx.sleep(retry);
|
|
876
|
+
await sendMessageByBot(channelId, botIndex, retry * 2);
|
|
873
877
|
return;
|
|
874
878
|
}
|
|
875
879
|
try {
|