mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
commit
e1f049229c
@ -484,7 +484,6 @@ class DBUtil extends DBUtilBase {
|
||||
userId: number,
|
||||
time: number
|
||||
) {
|
||||
if (ob11Config.GroupLocalTimeRecord[0] == -1 || ob11Config.GroupLocalTimeRecord.includes(groupId))
|
||||
this.LURCache.set(groupId, userId, time)
|
||||
}
|
||||
async insertJoinTime(
|
||||
@ -492,7 +491,6 @@ class DBUtil extends DBUtilBase {
|
||||
userId: number,
|
||||
time: number
|
||||
) {
|
||||
if (ob11Config.GroupLocalTimeRecord[0] == -1 || ob11Config.GroupLocalTimeRecord.includes(groupId)){
|
||||
await this.createGroupInfoTimeTableIfNotExist(groupId);
|
||||
this.db!.all(
|
||||
`INSERT OR REPLACE INTO "${groupId}" (user_id, last_sent_time, join_time) VALUES (?,?,?)`,
|
||||
@ -504,7 +502,7 @@ class DBUtil extends DBUtilBase {
|
||||
console.log("插入入群时间失败", userId, groupId);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { dbUtil } from '@/common/utils/db';
|
||||
import { ob11Config } from '@/onebot11/config';
|
||||
|
||||
type GroupIncreaseSubType = 'approve' | 'invite';
|
||||
export class OB11GroupIncreaseEvent extends OB11GroupNoticeEvent {
|
||||
@ -13,6 +14,7 @@ export class OB11GroupIncreaseEvent extends OB11GroupNoticeEvent {
|
||||
this.user_id = userId;
|
||||
this.sub_type = subType;
|
||||
|
||||
if((ob11Config.GroupLocalTimeRecord[0] == -1 || ob11Config.GroupLocalTimeRecord.includes(groupId)))
|
||||
dbUtil.insertJoinTime(groupId, userId, Math.floor(Date.now() / 1000))
|
||||
|
||||
}
|
||||
|
@ -286,7 +286,8 @@ export class NapCatOnebot11 {
|
||||
}
|
||||
if (msg.post_type === 'message') {
|
||||
logMessage(msg as OB11Message).then().catch(logError);
|
||||
if (msg.message_type == 'group' && msg.group_id && (ob11Config.GroupLocalTimeRecord as Array<number>).find((item) => item == msg.group_id)) {
|
||||
// 大概测试了一下,10000个以内 includes 和 find 性能差距不大
|
||||
if (msg.message_type == 'group' && msg.group_id && (ob11Config.GroupLocalTimeRecord[0] === -1 || ob11Config.GroupLocalTimeRecord.find(gid=>gid == msg.group_id))) {
|
||||
dbUtil.insertLastSentTime(msg.group_id, msg.user_id, msg.time);
|
||||
}
|
||||
} else if (msg.post_type === 'notice') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user