koishi-plugin-808ps-qunmax 0.0.2 → 0.0.3
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 +6 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -433,15 +433,15 @@ async function saveGroupMember(ctx, botSet, pool, groupId, config) {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
__name(saveGroupMember, "saveGroupMember");
|
|
436
|
-
async function checkRepeatPushLimit(mainPool, userId,
|
|
436
|
+
async function checkRepeatPushLimit(mainPool, userId, limitHours) {
|
|
437
437
|
const [logRows] = await mainPool.execute(`
|
|
438
|
-
SELECT MAX(capture_time) AS latest_time FROM drain_log WHERE monitor_qq = ?
|
|
439
|
-
`, [userId
|
|
438
|
+
SELECT MAX(capture_time) AS latest_time FROM drain_log WHERE monitor_qq = ?
|
|
439
|
+
`, [userId]);
|
|
440
440
|
const latestTimeStr = logRows[0].latest_time;
|
|
441
441
|
if (latestTimeStr && limitHours > 0) {
|
|
442
442
|
const hoursDiff = (0, import_dayjs.default)().diff((0, import_dayjs.default)(latestTimeStr), "hour");
|
|
443
443
|
if (hoursDiff < limitHours) {
|
|
444
|
-
logger.info(`[引流监控]
|
|
444
|
+
logger.info(`[引流监控] 用户${userId} 资料在${hoursDiff}小时内已推送,跳过重复推送`);
|
|
445
445
|
return true;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
@@ -974,7 +974,7 @@ async function apply(ctx, config) {
|
|
|
974
974
|
logger.info(`[外群监控] 群${groupId} 用户${userId} 是自身群成员,跳过推送`);
|
|
975
975
|
return;
|
|
976
976
|
}
|
|
977
|
-
if (await checkRepeatPushLimit(mainPool, userId,
|
|
977
|
+
if (await checkRepeatPushLimit(mainPool, userId, config.重复推送限制小时)) return;
|
|
978
978
|
await pushDrainData(mainPool, ctx, userId, groupId, subType, eventExtractor.getActionText(subType), config);
|
|
979
979
|
});
|
|
980
980
|
ctx.on("guild-member-removed", async (session) => {
|
|
@@ -995,7 +995,7 @@ async function apply(ctx, config) {
|
|
|
995
995
|
logger.info(`[外群监控] 群${groupId} 用户${userId} 是自身群成员,跳过推送`);
|
|
996
996
|
return;
|
|
997
997
|
}
|
|
998
|
-
if (await checkRepeatPushLimit(mainPool, userId,
|
|
998
|
+
if (await checkRepeatPushLimit(mainPool, userId, config.重复推送限制小时)) return;
|
|
999
999
|
await pushDrainData(mainPool, ctx, userId, groupId, subType, eventText, config);
|
|
1000
1000
|
});
|
|
1001
1001
|
ctx.setInterval(async () => await mainPool.execute("DELETE FROM duty_user WHERE expire_time < NOW()"), 5 * 60 * 1e3);
|