mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
refactor: info record local
This commit is contained in:
parent
4024b6c564
commit
9067a1fc92
@ -145,7 +145,8 @@ export function migrateConfig(oldConfig: any) {
|
||||
musicSignUrl: oldConfig.musicSignUrl,
|
||||
reportSelfMessage: oldConfig.reportSelfMessage,
|
||||
token: oldConfig.token,
|
||||
GroupLocalTimeRecord: []
|
||||
GroupLocalTimeRecord: false,
|
||||
GroupLocalTimeRecordList: []
|
||||
};
|
||||
return newConfig;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class GetGroupMemberList extends BaseAction<Payload, OB11GroupMember[]> {
|
||||
MemberMap.set(webGroupMembers[i]?.uin, MemberData);
|
||||
}
|
||||
}
|
||||
} else if (ob11Config.GroupLocalTimeRecord[0] === -1 || ob11Config.GroupLocalTimeRecord.includes(payload.group_id)) {
|
||||
} else if (ob11Config.GroupLocalTimeRecord && ob11Config.GroupLocalTimeRecordList[0] === -1 || ob11Config.GroupLocalTimeRecordList.includes(payload.group_id)) {
|
||||
const _sendAndJoinRember = await dbUtil.getLastSentTimeAndJoinTime(payload.group_id);
|
||||
_sendAndJoinRember.forEach((element) => {
|
||||
let MemberData = MemberMap.get(element.user_id);
|
||||
|
@ -32,8 +32,8 @@ export interface OB11Config {
|
||||
musicSignUrl: string;
|
||||
reportSelfMessage: boolean;
|
||||
token: string;
|
||||
|
||||
GroupLocalTimeRecord: Array<number>;
|
||||
GroupLocalTimeRecord: boolean;
|
||||
GroupLocalTimeRecordList: Array<number>;
|
||||
|
||||
read(): OB11Config;
|
||||
|
||||
@ -66,8 +66,8 @@ class Config extends ConfigBase<OB11Config> implements OB11Config {
|
||||
musicSignUrl = '';
|
||||
reportSelfMessage = false;
|
||||
token = '';
|
||||
|
||||
GroupLocalTimeRecord = [] as Array<number>;
|
||||
GroupLocalTimeRecord = false;
|
||||
GroupLocalTimeRecordList = [] as Array<number>;
|
||||
|
||||
getConfigPath() {
|
||||
return path.join(this.getConfigDir(), `onebot11_${selfInfo.uin}.json`);
|
||||
|
@ -287,7 +287,7 @@ export class NapCatOnebot11 {
|
||||
if (msg.post_type === 'message') {
|
||||
logMessage(msg as OB11Message).then().catch(logError);
|
||||
// 大概测试了一下,10000个以内 includes 和 find 性能差距不大
|
||||
if (msg.message_type == 'group' && msg.group_id && (ob11Config.GroupLocalTimeRecord[0] === -1 || ob11Config.GroupLocalTimeRecord.find(gid=>gid == msg.group_id))) {
|
||||
if (msg.message_type == 'group' && msg.group_id && ob11Config.GroupLocalTimeRecord && (ob11Config.GroupLocalTimeRecordList[0] === -1 || ob11Config.GroupLocalTimeRecordList.find(gid=>gid == msg.group_id))) {
|
||||
dbUtil.insertLastSentTime(msg.group_id, msg.user_id, msg.time);
|
||||
}
|
||||
} else if (msg.post_type === 'notice') {
|
||||
|
@ -69,7 +69,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
</div>
|
||||
<div class="q-input">
|
||||
<input id="config-ob11-http-secret" class="q-input__inner" data-config-key="ob11.http.secret" type="text" value="${ob11Config.http.secret
|
||||
}" placeholder="未设置" />
|
||||
}" placeholder="未设置" />
|
||||
</div>
|
||||
</setting-item>
|
||||
<setting-item data-direction="row">
|
||||
@ -101,8 +101,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
'control-display-id': 'config-ob11-reverseWs-urls',
|
||||
})
|
||||
),
|
||||
`<div class="config-host-list" id="config-ob11-reverseWs-urls" ${ob11Config.reverseWs.enable ? '' : 'is-hidden'
|
||||
}>
|
||||
`<div class="config-host-list" id="config-ob11-reverseWs-urls" ${ob11Config.reverseWs.enable ? '' : 'is-hidden' }>
|
||||
<setting-item data-direction="row">
|
||||
<div>
|
||||
<setting-text>反向 WebSocket 监听地址</setting-text>
|
||||
@ -138,7 +137,23 @@ async function onSettingWindowCreated(view: Element) {
|
||||
undefined,
|
||||
`<div class="q-input" style="width:210px;"><input class="q-input__inner" data-config-key="ob11.musicSignUrl" type="text" value="${ob11Config.musicSignUrl}" placeholder="未设置" /></div>`,
|
||||
'ob11.musicSignUrl'
|
||||
),
|
||||
SettingItem(
|
||||
'启用本地进群时间与发言时间记录',
|
||||
undefined,
|
||||
SettingSwitch('ob11.GroupLocalTimeRecord', ob11Config.reverseWs.enable, {
|
||||
'control-display-id': 'config-ob11-GroupLocalTimeRecordList',
|
||||
})
|
||||
),
|
||||
`<div class="config-host-list" id="config-ob11-GroupLocalTimeRecordList" ${ob11Config.reverseWs.enable ? '' : 'is-hidden'}>
|
||||
<setting-item data-direction="row">
|
||||
<div>
|
||||
<setting-text>反向 WebSocket 监听地址</setting-text>
|
||||
</div>
|
||||
<setting-button id="config-ob11-GroupLocalTimeRecordList-add" data-type="primary">添加</setting-button>
|
||||
</setting-item>
|
||||
<div id="config-ob11-GroupLocalTimeRecordList-list"></div>
|
||||
</div>`,
|
||||
SettingItem(
|
||||
'',
|
||||
undefined,
|
||||
|
@ -26,7 +26,8 @@ export interface OB11Config {
|
||||
musicSignUrl: '';
|
||||
reportSelfMessage: boolean;
|
||||
token: '';
|
||||
GroupLocalTimeRecord: [];
|
||||
GroupLocalTimeRecord: false;
|
||||
GroupLocalTimeRecordList: [];
|
||||
}
|
||||
|
||||
class WebUiApiOB11ConfigWrapper {
|
||||
|
Loading…
x
Reference in New Issue
Block a user