koishi-plugin-bilibili-notify 3.2.5-alpha.7 → 3.2.5-alpha.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 +19 -5
- package/lib/index.mjs +19 -5
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/index.js
CHANGED
|
@@ -820,34 +820,48 @@ var ComRegister = class {
|
|
|
820
820
|
this.logger.info("初始化推送群组/频道信息:");
|
|
821
821
|
this.logger.info(this.pushRecord);
|
|
822
822
|
}
|
|
823
|
-
|
|
823
|
+
checkAllBotsAreReady() {
|
|
824
|
+
const bot = this.ctx.bots.some((bot$1) => !bot$1.isActive);
|
|
825
|
+
return !bot;
|
|
826
|
+
}
|
|
827
|
+
async broadcastToTargets(uid, content, type, retry = 3e3) {
|
|
828
|
+
if (!this.checkAllBotsAreReady()) {
|
|
829
|
+
this.logger.error(`有机器人未准备好,无法进行推送,${retry / 1e3}秒后重试`);
|
|
830
|
+
this.ctx.setTimeout(() => {
|
|
831
|
+
this.broadcastToTargets(uid, content, type, retry * 2);
|
|
832
|
+
}, retry);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
824
835
|
this.logger.info(`本次推送对象:${uid},推送类型:${PushTypeMsg[type]}`);
|
|
825
836
|
const record = this.pushRecord[uid];
|
|
826
837
|
this.logger.info("本次推送目标:");
|
|
827
|
-
this.logger.info(record);
|
|
828
838
|
if (type === PushType.StartBroadcasting && record.atAllArr?.length >= 1) {
|
|
839
|
+
this.logger.info(record.atAllArr);
|
|
829
840
|
const success = await withRetry(async () => {
|
|
830
841
|
return await this.ctx.broadcast(record.atAllArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("at", { type: "all" }), /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content })] }));
|
|
831
842
|
}, 1);
|
|
832
843
|
this.logger.info(`成功推送全体成员消息群组/频道:${success}`);
|
|
833
844
|
}
|
|
834
845
|
if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
|
|
846
|
+
this.logger.info(record.dynamicArr);
|
|
835
847
|
const success = await withRetry(async () => {
|
|
836
848
|
return await this.ctx.broadcast(record.dynamicArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
|
|
837
849
|
}, 1);
|
|
838
|
-
this.logger.info(
|
|
850
|
+
this.logger.info(`成功推送动态消息群组/频道:${success}`);
|
|
839
851
|
}
|
|
840
852
|
if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
|
|
853
|
+
this.logger.info(record.liveArr);
|
|
841
854
|
const success = await withRetry(async () => {
|
|
842
855
|
return await this.ctx.broadcast(record.liveArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
|
|
843
856
|
}, 1);
|
|
844
|
-
this.logger.info(
|
|
857
|
+
this.logger.info(`成功推送直播消息群组/频道:${success}`);
|
|
845
858
|
}
|
|
846
859
|
if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
|
|
860
|
+
this.logger.info(record.liveGuardBuyArr);
|
|
847
861
|
const success = await withRetry(async () => {
|
|
848
862
|
return await this.ctx.broadcast(record.liveGuardBuyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
|
|
849
863
|
}, 1);
|
|
850
|
-
this.logger.info(
|
|
864
|
+
this.logger.info(`成功推送上舰消息群组/频道:${success}`);
|
|
851
865
|
}
|
|
852
866
|
return;
|
|
853
867
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -822,34 +822,48 @@ var ComRegister = class {
|
|
|
822
822
|
this.logger.info("初始化推送群组/频道信息:");
|
|
823
823
|
this.logger.info(this.pushRecord);
|
|
824
824
|
}
|
|
825
|
-
|
|
825
|
+
checkAllBotsAreReady() {
|
|
826
|
+
const bot = this.ctx.bots.some((bot$1) => !bot$1.isActive);
|
|
827
|
+
return !bot;
|
|
828
|
+
}
|
|
829
|
+
async broadcastToTargets(uid, content, type, retry = 3e3) {
|
|
830
|
+
if (!this.checkAllBotsAreReady()) {
|
|
831
|
+
this.logger.error(`有机器人未准备好,无法进行推送,${retry / 1e3}秒后重试`);
|
|
832
|
+
this.ctx.setTimeout(() => {
|
|
833
|
+
this.broadcastToTargets(uid, content, type, retry * 2);
|
|
834
|
+
}, retry);
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
826
837
|
this.logger.info(`本次推送对象:${uid},推送类型:${PushTypeMsg[type]}`);
|
|
827
838
|
const record = this.pushRecord[uid];
|
|
828
839
|
this.logger.info("本次推送目标:");
|
|
829
|
-
this.logger.info(record);
|
|
830
840
|
if (type === PushType.StartBroadcasting && record.atAllArr?.length >= 1) {
|
|
841
|
+
this.logger.info(record.atAllArr);
|
|
831
842
|
const success = await withRetry(async () => {
|
|
832
843
|
return await this.ctx.broadcast(record.atAllArr, /* @__PURE__ */ jsxs("message", { children: [/* @__PURE__ */ jsx("at", { type: "all" }), /* @__PURE__ */ jsx("message", { children: content })] }));
|
|
833
844
|
}, 1);
|
|
834
845
|
this.logger.info(`成功推送全体成员消息群组/频道:${success}`);
|
|
835
846
|
}
|
|
836
847
|
if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
|
|
848
|
+
this.logger.info(record.dynamicArr);
|
|
837
849
|
const success = await withRetry(async () => {
|
|
838
850
|
return await this.ctx.broadcast(record.dynamicArr, /* @__PURE__ */ jsx("message", { children: content }));
|
|
839
851
|
}, 1);
|
|
840
|
-
this.logger.info(
|
|
852
|
+
this.logger.info(`成功推送动态消息群组/频道:${success}`);
|
|
841
853
|
}
|
|
842
854
|
if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
|
|
855
|
+
this.logger.info(record.liveArr);
|
|
843
856
|
const success = await withRetry(async () => {
|
|
844
857
|
return await this.ctx.broadcast(record.liveArr, /* @__PURE__ */ jsx("message", { children: content }));
|
|
845
858
|
}, 1);
|
|
846
|
-
this.logger.info(
|
|
859
|
+
this.logger.info(`成功推送直播消息群组/频道:${success}`);
|
|
847
860
|
}
|
|
848
861
|
if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
|
|
862
|
+
this.logger.info(record.liveGuardBuyArr);
|
|
849
863
|
const success = await withRetry(async () => {
|
|
850
864
|
return await this.ctx.broadcast(record.liveGuardBuyArr, /* @__PURE__ */ jsx("message", { children: content }));
|
|
851
865
|
}, 1);
|
|
852
|
-
this.logger.info(
|
|
866
|
+
this.logger.info(`成功推送上舰消息群组/频道:${success}`);
|
|
853
867
|
}
|
|
854
868
|
return;
|
|
855
869
|
}
|
package/package.json
CHANGED