From d7f97a6fa0daeda51499f922a5155469a5d164a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 7 Aug 2024 09:53:48 +0800 Subject: [PATCH] =?UTF-8?q?style&chore:=20=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/QQBasicInfo.ts | 2 +- src/core/src/apis/group.ts | 2 +- .../action/extends/CreateCollection.ts | 1 - src/onebot11/action/extends/Debug.ts | 13 +-- .../action/extends/FetchEmojioLike.ts | 4 +- .../action/extends/GetCollectionList.ts | 2 - .../action/extends/GetRobotUinRange.ts | 1 - src/onebot11/action/extends/OCRImage.ts | 2 +- src/onebot11/action/extends/SetGroupHeader.ts | 2 - src/onebot11/action/extends/SetLongNick.ts | 1 - .../action/extends/SetOnlineStatus.ts | 8 +- src/onebot11/action/extends/SetQQAvatar.ts | 3 +- src/onebot11/action/extends/TestApi01.ts | 4 +- .../action/extends/TranslateEnWordToZn.ts | 6 +- src/onebot11/action/file/DelGroupFile.ts | 2 +- src/onebot11/action/file/GetFile.ts | 2 +- .../action/go-cqhttp/GetFriendMsgHistory.ts | 1 + .../action/go-cqhttp/GetGroupHonorInfo.ts | 2 +- .../action/go-cqhttp/GetStrangerInfo.ts | 1 - .../action/go-cqhttp/SendGroupNotice.ts | 2 - .../action/go-cqhttp/UploadGroupFile.ts | 2 +- .../action/go-cqhttp/UploadPrivareFile.ts | 3 +- src/onebot11/action/group/GetGroupEssence.ts | 4 - src/onebot11/action/group/GetGroupList.ts | 1 - .../action/group/GetGroupMemberInfoOld.ts | 84 ----------------- src/onebot11/action/group/SetEssenceMsg.ts | 4 +- .../action/group/SetGroupAddRequest.ts | 4 +- src/onebot11/action/index.ts | 2 - src/onebot11/action/msg/DeleteMsg.ts | 24 ++--- src/onebot11/action/msg/ForwardSingleMsg.ts | 2 +- src/onebot11/action/msg/GetMsg.ts | 4 +- .../msg/SendMsg/create-send-elements.ts | 2 +- .../action/msg/SendMsg/handle-forward-node.ts | 16 ++-- src/onebot11/action/msg/SendPrivateMsg.ts | 1 - src/onebot11/action/msg/SetMsgEmojiLike.ts | 1 - src/onebot11/action/system/CanSendImage.ts | 1 - src/onebot11/action/system/CleanCache.ts | 93 ------------------- src/onebot11/action/system/GetLoginInfo.ts | 2 - src/onebot11/action/user/GetFriendList.ts | 2 - src/onebot11/action/user/SendLike.ts | 1 - src/onebot11/constructor.ts | 48 +++++----- .../event/notice/OB11GroupAdminNoticeEvent.ts | 2 +- .../event/notice/OB11InputStatusEvent.ts | 2 +- src/onebot11/log.ts | 2 +- src/onebot11/main.ts | 4 +- 45 files changed, 74 insertions(+), 298 deletions(-) delete mode 100644 src/onebot11/action/group/GetGroupMemberInfoOld.ts delete mode 100644 src/onebot11/action/system/CleanCache.ts diff --git a/src/common/utils/QQBasicInfo.ts b/src/common/utils/QQBasicInfo.ts index e69c3827..527efca7 100644 --- a/src/common/utils/QQBasicInfo.ts +++ b/src/common/utils/QQBasicInfo.ts @@ -39,7 +39,7 @@ export function getAppidV2(): { appid: string, qua: string } { } } catch (e) { - log(`[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常`); + log('[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常'); } // 以下是兜底措施 log(`[QQ版本兼容性检测] ${getFullQQVesion()} 版本兼容性不佳,可能会导致一些功能无法正常使用`); diff --git a/src/core/src/apis/group.ts b/src/core/src/apis/group.ts index 1ccf1e99..6722d8bf 100644 --- a/src/core/src/apis/group.ts +++ b/src/core/src/apis/group.ts @@ -220,7 +220,7 @@ export class NTQQGroupApi { const _Pskey = (await NTQQUserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!; return napCatCore.session.getGroupService().uploadGroupBulletinPic(GroupCode, _Pskey, imageurl); } - static async handleGroupRequest(flag: string, operateType: GroupRequestOperateTypes, reason?: string) { + static async handleGroupRequest(flag: string , operateType: GroupRequestOperateTypes, reason?: string) { let flagitem = flag.split('|'); let groupCode = flagitem[0]; let seq = flagitem[1]; diff --git a/src/onebot11/action/extends/CreateCollection.ts b/src/onebot11/action/extends/CreateCollection.ts index df4245a6..199da51e 100644 --- a/src/onebot11/action/extends/CreateCollection.ts +++ b/src/onebot11/action/extends/CreateCollection.ts @@ -2,7 +2,6 @@ import { NTQQCollectionApi } from '@/core/apis/collection'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQUserApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { selfInfo } from '@/core/data'; diff --git a/src/onebot11/action/extends/Debug.ts b/src/onebot11/action/extends/Debug.ts index 6f73ae5d..2cac40da 100644 --- a/src/onebot11/action/extends/Debug.ts +++ b/src/onebot11/action/extends/Debug.ts @@ -1,16 +1,12 @@ import BaseAction from '../BaseAction'; -// import * as ntqqApi from "../../../ntqqapi/api"; import { NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi, - // NTQQFileCacheApi, } from '@/core'; import { ActionName } from '../types'; -import { log, logDebug } from '@/common/utils/log'; - interface Payload { method: string, args: any[], @@ -20,12 +16,8 @@ export default class Debug extends BaseAction { actionName = ActionName.Debug; protected async _handle(payload: Payload): Promise { - //logDebug('debug call ntqq api', payload); - const ntqqApi = [NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi, - // NTQQFileCacheApi, - ]; + const ntqqApi = [NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi,]; for (const ntqqApiClass of ntqqApi) { - // logDebug('ntqqApiClass', ntqqApiClass); const method = (ntqqApiClass)[payload.method]; if (method) { const result = method(...payload.args); @@ -36,8 +28,5 @@ export default class Debug extends BaseAction { } } throw `${payload.method}方法 不存在`; - - // const info = await NTQQApi.getUserDetailInfo(friends[0].uid); - // return info } } diff --git a/src/onebot11/action/extends/FetchEmojioLike.ts b/src/onebot11/action/extends/FetchEmojioLike.ts index baf43dc4..48a78eee 100644 --- a/src/onebot11/action/extends/FetchEmojioLike.ts +++ b/src/onebot11/action/extends/FetchEmojioLike.ts @@ -24,9 +24,9 @@ export class FetchEmojioLike extends BaseAction { PayloadSchema = SchemaData; protected async _handle(payload: Payload) { const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); - if(!msgIdPeer) throw new Error('消息不存在'); + if (!msgIdPeer) throw new Error('消息不存在'); const msg = (await NTQQMsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0]; - const ret = await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer,msg.msgSeq,payload.emojiId,payload.emojiType,payload.count); + const ret = await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer, msg.msgSeq, payload.emojiId, payload.emojiType, payload.count); return ret; } } diff --git a/src/onebot11/action/extends/GetCollectionList.ts b/src/onebot11/action/extends/GetCollectionList.ts index b768d555..de6add8a 100644 --- a/src/onebot11/action/extends/GetCollectionList.ts +++ b/src/onebot11/action/extends/GetCollectionList.ts @@ -2,9 +2,7 @@ import { NTQQCollectionApi } from '@/core/apis/collection'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQUserApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; -import { selfInfo } from '@/core/data'; const SchemaData = { type: 'object', diff --git a/src/onebot11/action/extends/GetRobotUinRange.ts b/src/onebot11/action/extends/GetRobotUinRange.ts index d5b85aba..2d67d136 100644 --- a/src/onebot11/action/extends/GetRobotUinRange.ts +++ b/src/onebot11/action/extends/GetRobotUinRange.ts @@ -5,7 +5,6 @@ export class GetRobotUinRange extends BaseAction> { actionName = ActionName.GetRobotUinRange; protected async _handle(payload: void) { - // console.log(await NTQQUserApi.getRobotUinRange()); return await NTQQUserApi.getRobotUinRange(); } } diff --git a/src/onebot11/action/extends/OCRImage.ts b/src/onebot11/action/extends/OCRImage.ts index 8128fe4e..023c254d 100644 --- a/src/onebot11/action/extends/OCRImage.ts +++ b/src/onebot11/action/extends/OCRImage.ts @@ -20,7 +20,7 @@ export class OCRImage extends BaseAction { actionName = ActionName.OCRImage; PayloadSchema = SchemaData; protected async _handle(payload: Payload) { - const { path, isLocal, errMsg,success } = (await uri2local(payload.image)); + const { path, isLocal, errMsg, success } = (await uri2local(payload.image)); if (!success) { throw `OCR ${payload.image}失败,image字段可能格式不正确`; } diff --git a/src/onebot11/action/extends/SetGroupHeader.ts b/src/onebot11/action/extends/SetGroupHeader.ts index 1998301b..312b92f1 100644 --- a/src/onebot11/action/extends/SetGroupHeader.ts +++ b/src/onebot11/action/extends/SetGroupHeader.ts @@ -1,10 +1,8 @@ import BaseAction from '../BaseAction'; import { ActionName, BaseCheckResult } from '../types'; import * as fs from 'node:fs'; -import { NTQQUserApi } from '@/core/apis/user'; import { checkFileReceived, uri2local } from '@/common/utils/file'; import { NTQQGroupApi } from '@/core'; -// import { log } from "../../../common/utils"; interface Payload { file: string, diff --git a/src/onebot11/action/extends/SetLongNick.ts b/src/onebot11/action/extends/SetLongNick.ts index 2f1f8c5d..1362996a 100644 --- a/src/onebot11/action/extends/SetLongNick.ts +++ b/src/onebot11/action/extends/SetLongNick.ts @@ -1,4 +1,3 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { NTQQUserApi } from '@/core/apis'; diff --git a/src/onebot11/action/extends/SetOnlineStatus.ts b/src/onebot11/action/extends/SetOnlineStatus.ts index c06a2292..76253fe6 100644 --- a/src/onebot11/action/extends/SetOnlineStatus.ts +++ b/src/onebot11/action/extends/SetOnlineStatus.ts @@ -1,5 +1,5 @@ import BaseAction from '../BaseAction'; -import { ActionName, BaseCheckResult } from '../types'; +import { ActionName } from '../types'; import { NTQQUserApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; // 设置在线状态 @@ -20,12 +20,6 @@ export class SetOnlineStatus extends BaseAction { actionName = ActionName.SetOnlineStatus; PayloadSchema = SchemaData; protected async _handle(payload: Payload) { - // 可设置状态 - // { status: 10, extStatus: 1027, batteryStatus: 0 } - // { status: 30, extStatus: 0, batteryStatus: 0 } - // { status: 50, extStatus: 0, batteryStatus: 0 } - // { status: 60, extStatus: 0, batteryStatus: 0 } - // { status: 70, extStatus: 0, batteryStatus: 0 } const ret = await NTQQUserApi.setSelfOnlineStatus(payload.status, payload.extStatus, payload.batteryStatus); if (ret.result !== 0) { throw new Error('设置在线状态失败'); diff --git a/src/onebot11/action/extends/SetQQAvatar.ts b/src/onebot11/action/extends/SetQQAvatar.ts index f8006344..dc084a5f 100644 --- a/src/onebot11/action/extends/SetQQAvatar.ts +++ b/src/onebot11/action/extends/SetQQAvatar.ts @@ -3,7 +3,6 @@ import { ActionName, BaseCheckResult } from '../types'; import * as fs from 'node:fs'; import { NTQQUserApi } from '@/core/apis/user'; import { checkFileReceived, uri2local } from '@/common/utils/file'; -// import { log } from "../../../common/utils"; interface Payload { file: string @@ -24,7 +23,7 @@ export default class SetAvatar extends BaseAction { }; } protected async _handle(payload: Payload): Promise { - const { path, isLocal, errMsg,success } = (await uri2local(payload.file)); + const { path, isLocal, errMsg, success } = (await uri2local(payload.file)); if (!success) { throw `头像${payload.file}设置失败,file字段可能格式不正确`; } diff --git a/src/onebot11/action/extends/TestApi01.ts b/src/onebot11/action/extends/TestApi01.ts index 566d63d2..224fde82 100644 --- a/src/onebot11/action/extends/TestApi01.ts +++ b/src/onebot11/action/extends/TestApi01.ts @@ -18,9 +18,7 @@ export default class TestApi01 extends BaseAction { actionName = ActionName.TestApi01; // 用不着复杂检测 protected async check(payload: Payload): Promise { - return { - valid: true, - }; + return { valid: true }; } protected async _handle(payload: Payload): Promise { return await napCatCore.session.getMsgService().sendSsoCmdReqByContend(payload.cmd, payload.param); diff --git a/src/onebot11/action/extends/TranslateEnWordToZn.ts b/src/onebot11/action/extends/TranslateEnWordToZn.ts index 8088ab6d..4c3a5f94 100644 --- a/src/onebot11/action/extends/TranslateEnWordToZn.ts +++ b/src/onebot11/action/extends/TranslateEnWordToZn.ts @@ -1,9 +1,7 @@ import BaseAction from '../BaseAction'; -import { ActionName, BaseCheckResult } from '../types'; -import { NTQQSystemApi, NTQQUserApi } from '@/core/apis'; +import { ActionName } from '../types'; +import { NTQQSystemApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; -import Ajv from 'ajv'; -// 设置在线状态 const SchemaData = { type: 'object', diff --git a/src/onebot11/action/file/DelGroupFile.ts b/src/onebot11/action/file/DelGroupFile.ts index 498cfe13..5b7c080e 100644 --- a/src/onebot11/action/file/DelGroupFile.ts +++ b/src/onebot11/action/file/DelGroupFile.ts @@ -1,7 +1,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQGroupApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis'; +import { NTQQGroupApi } from '@/core/apis'; const SchemaData = { type: 'object', diff --git a/src/onebot11/action/file/GetFile.ts b/src/onebot11/action/file/GetFile.ts index 85672682..12dc23aa 100644 --- a/src/onebot11/action/file/GetFile.ts +++ b/src/onebot11/action/file/GetFile.ts @@ -2,7 +2,7 @@ import BaseAction from '../BaseAction'; import fs from 'fs/promises'; import { ob11Config } from '@/onebot11/config'; import { UUIDConverter } from '@/common/utils/helper'; -import { ActionName, BaseCheckResult } from '../types'; +import { ActionName } from '../types'; import { ChatType, ElementType, FileElement, Peer, RawMessage, VideoElement } from '@/core/entities'; import { NTQQFileApi, NTQQFriendApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; diff --git a/src/onebot11/action/go-cqhttp/GetFriendMsgHistory.ts b/src/onebot11/action/go-cqhttp/GetFriendMsgHistory.ts index 3ca15764..aba282a2 100644 --- a/src/onebot11/action/go-cqhttp/GetFriendMsgHistory.ts +++ b/src/onebot11/action/go-cqhttp/GetFriendMsgHistory.ts @@ -50,6 +50,7 @@ export default class GetFriendMsgHistory extends BaseAction { await Promise.all(msgList.map(async msg => { msg.id = MessageUnique.createMsg({ guildId: '', chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId); })); + //转换消息 const ob11MsgList = await Promise.all(msgList.map(msg => OB11Constructor.message(msg))); return { 'messages': ob11MsgList }; diff --git a/src/onebot11/action/go-cqhttp/GetGroupHonorInfo.ts b/src/onebot11/action/go-cqhttp/GetGroupHonorInfo.ts index 2d84f476..07d78bf5 100644 --- a/src/onebot11/action/go-cqhttp/GetGroupHonorInfo.ts +++ b/src/onebot11/action/go-cqhttp/GetGroupHonorInfo.ts @@ -6,7 +6,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, + group_id: { type: ['number', 'string'] }, type: { enum: [WebHonorType.ALL, WebHonorType.EMOTION, WebHonorType.LEGEND, WebHonorType.PERFROMER, WebHonorType.STORONGE_NEWBI, WebHonorType.TALKACTIVE] } }, required: ['group_id'] diff --git a/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts b/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts index b7f1c223..812757f7 100644 --- a/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts +++ b/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts @@ -44,7 +44,6 @@ export default class GoCQHTTPGetStrangerInfo extends BaseAction { if (PublishGroupBulletinResult.result != 0) { throw `设置群公告失败,错误信息:${PublishGroupBulletinResult.errMsg}`; } - // 下面实现扬了 - //await WebApi.setGroupNotice(payload.group_id, payload.content) ; return null; } } diff --git a/src/onebot11/action/go-cqhttp/UploadGroupFile.ts b/src/onebot11/action/go-cqhttp/UploadGroupFile.ts index d00895db..5382227b 100644 --- a/src/onebot11/action/go-cqhttp/UploadGroupFile.ts +++ b/src/onebot11/action/go-cqhttp/UploadGroupFile.ts @@ -4,7 +4,7 @@ import { ActionName } from '../types'; import { SendMsgElementConstructor } from '@/core/entities/constructor'; import { ChatType, SendFileElement } from '@/core/entities'; import fs from 'fs'; -import { SendMsg, sendMsg } from '@/onebot11/action/msg/SendMsg'; +import { sendMsg } from '@/onebot11/action/msg/SendMsg'; import { uri2local } from '@/common/utils/file'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { diff --git a/src/onebot11/action/go-cqhttp/UploadPrivareFile.ts b/src/onebot11/action/go-cqhttp/UploadPrivareFile.ts index 853ca721..d4aa51ab 100644 --- a/src/onebot11/action/go-cqhttp/UploadPrivareFile.ts +++ b/src/onebot11/action/go-cqhttp/UploadPrivareFile.ts @@ -1,10 +1,9 @@ import BaseAction from '../BaseAction'; -import { getGroup } from '@/core/data'; import { ActionName } from '../types'; import { SendMsgElementConstructor } from '@/core/entities/constructor'; import { ChatType, Peer, SendFileElement } from '@/core/entities'; import fs from 'fs'; -import { SendMsg, sendMsg } from '@/onebot11/action/msg/SendMsg'; +import { sendMsg } from '@/onebot11/action/msg/SendMsg'; import { uri2local } from '@/common/utils/file'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { NTQQFriendApi, NTQQUserApi } from '@/core'; diff --git a/src/onebot11/action/group/GetGroupEssence.ts b/src/onebot11/action/group/GetGroupEssence.ts index 7e90d6fc..7393efb1 100644 --- a/src/onebot11/action/group/GetGroupEssence.ts +++ b/src/onebot11/action/group/GetGroupEssence.ts @@ -1,9 +1,5 @@ -import { getGroup } from '@/core/data'; -import { OB11Group } from '../../types'; -import { OB11Constructor } from '../../constructor'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQMsgApi } from '@/core/apis/msg'; import { GroupEssenceMsgRet, WebApi } from '@/core/apis/webapi'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; diff --git a/src/onebot11/action/group/GetGroupList.ts b/src/onebot11/action/group/GetGroupList.ts index 396649ff..d5cebb4c 100644 --- a/src/onebot11/action/group/GetGroupList.ts +++ b/src/onebot11/action/group/GetGroupList.ts @@ -5,7 +5,6 @@ import { ActionName } from '../types'; import { NTQQGroupApi } from '@/core/apis'; import { Group } from '@/core/entities'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; -// no_cache get时传字符串 const SchemaData = { type: 'object', properties: { diff --git a/src/onebot11/action/group/GetGroupMemberInfoOld.ts b/src/onebot11/action/group/GetGroupMemberInfoOld.ts deleted file mode 100644 index 7d9708ce..00000000 --- a/src/onebot11/action/group/GetGroupMemberInfoOld.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { OB11GroupMember } from '../../types'; -import { getGroup, getGroupMember, groupMembers, selfInfo } from '@/core/data'; -import { OB11Constructor } from '../../constructor'; -import BaseAction from '../BaseAction'; -import { ActionName } from '../types'; -import { NTQQUserApi } from '@/core/apis/user'; -import { logDebug } from '@/common/utils/log'; -import { WebApi } from '@/core/apis/webapi'; -import { NTQQGroupApi } from '@/core'; -import { FromSchema, JSONSchema } from 'json-schema-to-ts'; -import { requireMinNTQQBuild } from '@/common/utils/QQBasicInfo'; - -// no_cache get时传字符串 -const SchemaData = { - type: 'object', - properties: { - group_id: { type: ['number', 'string'] }, - user_id: { type: ['number', 'string'] }, - no_cache: { type: ['boolean', 'string'] }, - }, - required: ['group_id', 'user_id'] -} as const satisfies JSONSchema; - -type Payload = FromSchema; - -class GetGroupMemberInfo extends BaseAction { - actionName = ActionName.GetGroupMemberInfo; - PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { - if (requireMinNTQQBuild('26702')) { - const V2Data = await NTQQGroupApi.getGroupMemberV2(payload.group_id.toString(), payload.user_id.toString(), payload.no_cache == true || payload.no_cache === 'true'); - if (V2Data) { - return OB11Constructor.groupMember(payload.group_id.toString(), V2Data); - } else { - throw (`群(${payload.group_id})成员${payload.user_id}不存在`); - } - } - const group = await getGroup(payload.group_id.toString()); - const role = (await getGroupMember(payload.group_id, selfInfo.uin))?.role; - const isPrivilege = role === 3 || role === 4; - if (!group) { - throw (`群(${payload.group_id})不存在`); - } - if (payload.no_cache == true || payload.no_cache === 'true') { - groupMembers.set(group.groupCode, await NTQQGroupApi.getGroupMembers(payload.group_id.toString())); - } - const member = await getGroupMember(payload.group_id.toString(), payload.user_id.toString()); - //早返回 - if (!member) { - throw (`群(${payload.group_id})成员${payload.user_id}不存在`); - } - //console.log('GetGroupMemberInfo', JSON.stringify(await NTQQGroupApi.getGroupMemberV2(payload.group_id.toString(), member.uid, true), null, 4)); - try { - const info = (await NTQQUserApi.getUserDetailInfo(member.uid)); - logDebug('群成员详细信息结果', info); - Object.assign(member, info); - } catch (e) { - logDebug('获取群成员详细信息失败, 只能返回基础信息', e); - } - const retMember = OB11Constructor.groupMember(payload.group_id.toString(), member); - if (isPrivilege) { - const webGroupMembers = await WebApi.getGroupMembers(payload.group_id.toString()); - for (let i = 0, len = webGroupMembers.length; i < len; i++) { - if (webGroupMembers[i]?.uin && webGroupMembers[i].uin === retMember.user_id) { - retMember.join_time = webGroupMembers[i]?.join_time; - retMember.last_sent_time = webGroupMembers[i]?.last_speak_time; - retMember.qage = webGroupMembers[i]?.qage; - retMember.level = webGroupMembers[i]?.lv.level.toString(); - } - } - } else { - const LastestMsgList = await NTQQGroupApi.getLastestMsg(payload.group_id.toString(), [payload.user_id.toString()]); - if (LastestMsgList?.msgList?.length && LastestMsgList?.msgList?.length > 0) { - const last_send_time = LastestMsgList.msgList[0].msgTime; - if (last_send_time && last_send_time != '0' && last_send_time != '') { - retMember.last_sent_time = parseInt(last_send_time); - retMember.join_time = Math.round(Date.now() / 1000);//兜底数据 防止群管乱杀 - } - } - } - return retMember; - } -} -export default GetGroupMemberInfo; \ No newline at end of file diff --git a/src/onebot11/action/group/SetEssenceMsg.ts b/src/onebot11/action/group/SetEssenceMsg.ts index b8cb2f45..3ee19661 100644 --- a/src/onebot11/action/group/SetEssenceMsg.ts +++ b/src/onebot11/action/group/SetEssenceMsg.ts @@ -1,7 +1,7 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; -import { NTQQGroupApi, NTQQMsgApi } from '@/core'; +import { NTQQGroupApi } from '@/core'; import { MessageUnique } from '@/common/utils/MessageUnique'; const SchemaData = { @@ -18,7 +18,7 @@ export default class SetEssenceMsg extends BaseAction { actionName = ActionName.SetEssenceMsg; PayloadSchema = SchemaData; protected async _handle(payload: Payload): Promise { - const msg = await MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); + const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); if (!msg) { throw new Error('msg not found'); } diff --git a/src/onebot11/action/group/SetGroupAddRequest.ts b/src/onebot11/action/group/SetGroupAddRequest.ts index 3f079ff1..484a8090 100644 --- a/src/onebot11/action/group/SetGroupAddRequest.ts +++ b/src/onebot11/action/group/SetGroupAddRequest.ts @@ -9,7 +9,7 @@ const SchemaData = { properties: { flag: { type: 'string' }, approve: { type: ['string', 'boolean'] }, - reason: { type: 'string', nullable: true, } + reason: { type: 'string', nullable: true } }, required: ['flag'], } as const satisfies JSONSchema; @@ -24,7 +24,7 @@ export default class SetGroupAddRequest extends BaseAction { const approve = payload.approve?.toString() !== 'false'; await NTQQGroupApi.handleGroupRequest(flag, approve ? GroupRequestOperateTypes.approve : GroupRequestOperateTypes.reject, - payload.reason + payload.reason || '' ); return null; } diff --git a/src/onebot11/action/index.ts b/src/onebot11/action/index.ts index f4df4ea3..4e33eaf9 100644 --- a/src/onebot11/action/index.ts +++ b/src/onebot11/action/index.ts @@ -35,9 +35,7 @@ import SetGroupCard from './group/SetGroupCard'; import GetImage from './file/GetImage'; import GetRecord from './file/GetRecord'; import { GoCQHTTPMarkMsgAsRead, MarkAllMsgAsRead, MarkGroupMsgAsRead, MarkPrivateMsgAsRead } from './msg/MarkMsgAsRead'; -import CleanCache from './system/CleanCache'; import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile'; -import { GetConfigAction, SetConfigAction } from '@/onebot11/action/extends/Config'; import GetGroupAddRequest from '@/onebot11/action/extends/GetGroupAddRequest'; import SetQQAvatar from '@/onebot11/action/extends/SetQQAvatar'; import GoCQHTTPDownloadFile from './go-cqhttp/DownloadFile'; diff --git a/src/onebot11/action/msg/DeleteMsg.ts b/src/onebot11/action/msg/DeleteMsg.ts index f180329c..3fd3f015 100644 --- a/src/onebot11/action/msg/DeleteMsg.ts +++ b/src/onebot11/action/msg/DeleteMsg.ts @@ -28,20 +28,20 @@ class DeleteMsg extends BaseAction { protected async _handle(payload: Payload) { const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id)); if (msg) { - let ret = NTEventDispatch.RegisterListen - ( - 'NodeIKernelMsgListener/onMsgInfoListUpdate', - 1, - 5000, - (msgs) => { - if (msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0')) { - return true; - } - return false; + const ret = NTEventDispatch.RegisterListen + ( + 'NodeIKernelMsgListener/onMsgInfoListUpdate', + 1, + 5000, + (msgs) => { + if (msgs.find(m => m.msgId === msg.MsgId && m.recallTime !== '0')) { + return true; } - ).catch(e => new Promise((resolve, reject) => { resolve(undefined) })); + return false; + } + ).catch(e => new Promise((resolve, reject) => { resolve(undefined); })); await NTQQMsgApi.recallMsg(msg.Peer, [msg.MsgId]); - let data = await ret; + const data = await ret; if (!data) { throw new Error('Recall failed'); } diff --git a/src/onebot11/action/msg/ForwardSingleMsg.ts b/src/onebot11/action/msg/ForwardSingleMsg.ts index 1c200437..1d13c0c6 100644 --- a/src/onebot11/action/msg/ForwardSingleMsg.ts +++ b/src/onebot11/action/msg/ForwardSingleMsg.ts @@ -30,7 +30,7 @@ class ForwardSingleMsg extends BaseAction { } protected async _handle(payload: Payload): Promise { - const msg = await MessageUnique.getMsgIdAndPeerByShortId(payload.message_id); + const msg = MessageUnique.getMsgIdAndPeerByShortId(payload.message_id); if (!msg) { throw new Error(`无法找到消息${payload.message_id}`); } diff --git a/src/onebot11/action/msg/GetMsg.ts b/src/onebot11/action/msg/GetMsg.ts index 29edde9e..d9c6c54b 100644 --- a/src/onebot11/action/msg/GetMsg.ts +++ b/src/onebot11/action/msg/GetMsg.ts @@ -27,8 +27,8 @@ class GetMsg extends BaseAction { if (!payload.message_id) { throw Error('参数message_id不能为空'); } - const MsgShortId = await MessageUnique.getShortIdByMsgId(payload.message_id.toString()); - const msgIdWithPeer = await MessageUnique.getMsgIdAndPeerByShortId(MsgShortId || parseInt(payload.message_id.toString())); + const MsgShortId = MessageUnique.getShortIdByMsgId(payload.message_id.toString()); + const msgIdWithPeer = MessageUnique.getMsgIdAndPeerByShortId(MsgShortId || parseInt(payload.message_id.toString())); if (!msgIdWithPeer) { throw ('消息不存在'); } diff --git a/src/onebot11/action/msg/SendMsg/create-send-elements.ts b/src/onebot11/action/msg/SendMsg/create-send-elements.ts index e23b0356..accc3ed7 100644 --- a/src/onebot11/action/msg/SendMsg/create-send-elements.ts +++ b/src/onebot11/action/msg/SendMsg/create-send-elements.ts @@ -18,7 +18,7 @@ import { uri2local } from '@/common/utils/file'; import { ob11Config } from '@/onebot11/config'; import { RequestUtil } from '@/common/utils/request'; import { MessageUnique } from '@/common/utils/MessageUnique'; -console.log(process.pid) +console.log(process.pid); export type MessageContext = { deleteAfterSentFiles: string[], peer:Peer diff --git a/src/onebot11/action/msg/SendMsg/handle-forward-node.ts b/src/onebot11/action/msg/SendMsg/handle-forward-node.ts index c01c26e0..7aeab575 100644 --- a/src/onebot11/action/msg/SendMsg/handle-forward-node.ts +++ b/src/onebot11/action/msg/SendMsg/handle-forward-node.ts @@ -51,24 +51,24 @@ export async function handleForwardNode(destPeer: Peer, messageNodes: OB11Messag } else { // 自定义的消息 try { - let OB11Data = normalize(messageNode.data.content); + const OB11Data = normalize(messageNode.data.content); //筛选node消息 - let isNodeMsg = OB11Data.filter(e => e.type === OB11MessageDataType.node).length;//找到子转发消息 + const isNodeMsg = OB11Data.filter(e => e.type === OB11MessageDataType.node).length;//找到子转发消息 if (isNodeMsg !== 0) { if (isNodeMsg !== OB11Data.length) { logError('子消息中包含非node消息 跳过不合法部分'); continue; } const nodeMsg = await handleForwardNode(selfPeer, OB11Data.filter(e => e.type === OB11MessageDataType.node)); - if (nodeMsg) { nodeMsgIds.push(nodeMsg.msgId); MessageUnique.createMsg(selfPeer, nodeMsg.msgId) }; + if (nodeMsg) { nodeMsgIds.push(nodeMsg.msgId); MessageUnique.createMsg(selfPeer, nodeMsg.msgId); } //完成子卡片生成跳过后续 continue; } const { sendElements } = await createSendElements(OB11Data, destPeer); //拆分消息 - let MixElement = sendElements.filter(element => element.elementType !== ElementType.FILE && element.elementType !== ElementType.VIDEO); - let SingleElement = sendElements.filter(element => element.elementType === ElementType.FILE || element.elementType === ElementType.VIDEO).map(e => [e]); - let AllElement: SendMessageElement[][] = [MixElement, ...SingleElement].filter(e => e !== undefined && e.length !== 0); + const MixElement = sendElements.filter(element => element.elementType !== ElementType.FILE && element.elementType !== ElementType.VIDEO); + const SingleElement = sendElements.filter(element => element.elementType === ElementType.FILE || element.elementType === ElementType.VIDEO).map(e => [e]); + const AllElement: SendMessageElement[][] = [MixElement, ...SingleElement].filter(e => e !== undefined && e.length !== 0); const MsgNodeList: Promise[] = []; for (const sendElementsSplitElement of AllElement) { - MsgNodeList.push(sendMsg(selfPeer, sendElementsSplitElement, [], true).catch(e => new Promise((resolve, reject) => { resolve(undefined) }))); + MsgNodeList.push(sendMsg(selfPeer, sendElementsSplitElement, [], true).catch(e => new Promise((resolve, reject) => { resolve(undefined); }))); } (await Promise.allSettled(MsgNodeList)).map((result) => { if (result.status === 'fulfilled' && result.value) { @@ -85,7 +85,7 @@ export async function handleForwardNode(destPeer: Peer, messageNodes: OB11Messag let srcPeer: Peer | undefined = undefined; let needSendSelf = false; //检测是否处于同一个Peer 不在同一个peer则全部消息由自身发送 - for (let msgId of nodeMsgIds) { + for (const msgId of nodeMsgIds) { const nodeMsgPeer = MessageUnique.getPeerByMsgId(msgId); if (!nodeMsgPeer) { logError('转发消息失败,未找到消息', msgId); diff --git a/src/onebot11/action/msg/SendPrivateMsg.ts b/src/onebot11/action/msg/SendPrivateMsg.ts index 7c5cd7e3..b198b090 100644 --- a/src/onebot11/action/msg/SendPrivateMsg.ts +++ b/src/onebot11/action/msg/SendPrivateMsg.ts @@ -11,5 +11,4 @@ class SendPrivateMsg extends SendMsg { return super.check(payload); } } - export default SendPrivateMsg; diff --git a/src/onebot11/action/msg/SetMsgEmojiLike.ts b/src/onebot11/action/msg/SetMsgEmojiLike.ts index edb8edcc..f44313ab 100644 --- a/src/onebot11/action/msg/SetMsgEmojiLike.ts +++ b/src/onebot11/action/msg/SetMsgEmojiLike.ts @@ -14,7 +14,6 @@ const SchemaData = { } as const satisfies JSONSchema; type Payload = FromSchema; - export class SetMsgEmojiLike extends BaseAction { actionName = ActionName.SetMsgEmojiLike; PayloadSchema = SchemaData; diff --git a/src/onebot11/action/system/CanSendImage.ts b/src/onebot11/action/system/CanSendImage.ts index 459c3e66..683e69fb 100644 --- a/src/onebot11/action/system/CanSendImage.ts +++ b/src/onebot11/action/system/CanSendImage.ts @@ -4,7 +4,6 @@ import CanSendRecord from './CanSendRecord'; interface ReturnType { yes: boolean } - export default class CanSendImage extends CanSendRecord { actionName = ActionName.CanSendImage; } diff --git a/src/onebot11/action/system/CleanCache.ts b/src/onebot11/action/system/CleanCache.ts deleted file mode 100644 index 0e0cafc2..00000000 --- a/src/onebot11/action/system/CleanCache.ts +++ /dev/null @@ -1,93 +0,0 @@ -import BaseAction from '../BaseAction'; -import { ActionName } from '../types'; -import fs from 'fs'; -import Path from 'path'; -import { - ChatType, - ChatCacheListItemBasic, - CacheFileType -} from '@/core/entities'; -import { NTQQFileApi, NTQQFileCacheApi } from '@/core/apis/file'; -import { logError } from '@/common/utils/log'; - -export default class CleanCache extends BaseAction { - actionName = ActionName.CleanCache; - - protected _handle(): Promise { - return new Promise(async (res, rej) => { - try { - // dbUtil.clearCache(); - const cacheFilePaths: string[] = []; - - await NTQQFileCacheApi.setCacheSilentScan(false); - - cacheFilePaths.push((await NTQQFileCacheApi.getHotUpdateCachePath())); - cacheFilePaths.push((await NTQQFileCacheApi.getDesktopTmpPath())); - (await NTQQFileCacheApi.getCacheSessionPathList()).forEach((e: { value: string; }) => cacheFilePaths.push(e.value)); - - // await NTQQApi.addCacheScannedPaths(); // XXX: 调用就崩溃,原因目前还未知 - const cacheScanResult = await NTQQFileCacheApi.scanCache(); - const cacheSize = parseInt(cacheScanResult.size[6]); - - if (cacheScanResult.result !== 0) { - throw('Something went wrong while scanning cache. Code: ' + cacheScanResult.result); - } - - await NTQQFileCacheApi.setCacheSilentScan(true); - if (cacheSize > 0 && cacheFilePaths.length > 2) { // 存在缓存文件且大小不为 0 时执行清理动作 - // await NTQQApi.clearCache([ 'tmp', 'hotUpdate', ...cacheScanResult ]) // XXX: 也是调用就崩溃,调用 fs 删除得了 - deleteCachePath(cacheFilePaths); - } - - // 获取聊天记录列表 - // NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关 - // const privateChatCache = await getCacheList(ChatType.friend); // 私聊消息 - // const groupChatCache = await getCacheList(ChatType.group); // 群聊消息 - // const chatCacheList = [ ...privateChatCache, ...groupChatCache ]; - const chatCacheList: ChatCacheListItemBasic[] = []; - - // 获取聊天缓存文件列表 - const cacheFileList: string[] = []; - - for (const name in CacheFileType) { - if (!isNaN(parseInt(name))) continue; - - const fileTypeAny: any = CacheFileType[name]; - const fileType: CacheFileType = fileTypeAny; - - cacheFileList.push(...(await NTQQFileCacheApi.getFileCacheInfo(fileType)).infos.map((file: { fileKey: any; }) => file.fileKey)); - } - - // 一并清除 - await NTQQFileCacheApi.clearChatCache(chatCacheList, cacheFileList); - res(); - } catch(e) { - logError('清理缓存时发生了错误'); - rej(e); - } - }); - } -} - -function deleteCachePath(pathList: string[]) { - const emptyPath = (path: string) => { - if (!fs.existsSync(path)) return; - const files = fs.readdirSync(path); - files.forEach(file => { - const filePath = Path.resolve(path, file); - const stats = fs.statSync(filePath); - if (stats.isDirectory()) emptyPath(filePath); - else fs.unlinkSync(filePath); - }); - fs.rmdirSync(path); - }; - - for (const path of pathList) { - emptyPath(path); - } -} - -function getCacheList(type: ChatType) { // NOTE: 做这个方法主要是因为目前还不支持针对频道消息的清理 - return new Promise>((res, rej) => { - }); -} diff --git a/src/onebot11/action/system/GetLoginInfo.ts b/src/onebot11/action/system/GetLoginInfo.ts index 7d43d3b7..4b3ceca9 100644 --- a/src/onebot11/action/system/GetLoginInfo.ts +++ b/src/onebot11/action/system/GetLoginInfo.ts @@ -3,8 +3,6 @@ import { OB11User } from '../../types'; import { OB11Constructor } from '../../constructor'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { napCatCore } from '@/core'; - class GetLoginInfo extends BaseAction { actionName = ActionName.GetLoginInfo; diff --git a/src/onebot11/action/user/GetFriendList.ts b/src/onebot11/action/user/GetFriendList.ts index e72eaa31..250ffa37 100644 --- a/src/onebot11/action/user/GetFriendList.ts +++ b/src/onebot11/action/user/GetFriendList.ts @@ -6,8 +6,6 @@ import { ActionName } from '../types'; import { NTQQFriendApi } from '@/core'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { requireMinNTQQBuild } from '@/common/utils/QQBasicInfo'; - - // no_cache get时传字符串 const SchemaData = { type: 'object', diff --git a/src/onebot11/action/user/SendLike.ts b/src/onebot11/action/user/SendLike.ts index a3197523..545889ab 100644 --- a/src/onebot11/action/user/SendLike.ts +++ b/src/onebot11/action/user/SendLike.ts @@ -13,7 +13,6 @@ const SchemaData = { } as const satisfies JSONSchema; type Payload = FromSchema; - export default class SendLike extends BaseAction { actionName = ActionName.SendLike; PayloadSchema = SchemaData; diff --git a/src/onebot11/constructor.ts b/src/onebot11/constructor.ts index bc23baae..353e69e4 100644 --- a/src/onebot11/constructor.ts +++ b/src/onebot11/constructor.ts @@ -210,13 +210,13 @@ export class OB11Constructor { chatType: msg.chatType, guildId: '', }, - msg.msgId, - msg.msgSeq, - msg.senderUid, - element.elementId, - element.elementType.toString(), - FileElement.fileSize, - FileElement.fileName + msg.msgId, + msg.msgSeq, + msg.senderUid, + element.elementId, + element.elementType.toString(), + FileElement.fileSize, + FileElement.fileName ); } else if (element.videoElement) { @@ -261,13 +261,13 @@ export class OB11Constructor { chatType: msg.chatType, guildId: '', }, - msg.msgId, - msg.msgSeq, - msg.senderUid, - element.elementId, - element.elementType.toString(), - videoElement.fileSize || '0', - videoElement.fileName + msg.msgId, + msg.msgSeq, + msg.senderUid, + element.elementId, + element.elementType.toString(), + videoElement.fileSize || '0', + videoElement.fileName ); } else if (element.pttElement) { @@ -282,13 +282,13 @@ export class OB11Constructor { chatType: msg.chatType, guildId: '', }, - msg.msgId, - msg.msgSeq, - msg.senderUid, - element.elementId, - element.elementType.toString(), - element.pttElement.fileSize || '0', - element.pttElement.fileUuid || '' + msg.msgId, + msg.msgSeq, + msg.senderUid, + element.elementId, + element.elementType.toString(), + element.pttElement.fileSize || '0', + element.pttElement.fileUuid || '' ); //以uuid作为文件名 } @@ -340,17 +340,17 @@ export class OB11Constructor { msg.parentMsgIdList.push(msg.msgId); //let parentMsgId = msg.parentMsgIdList[msg.parentMsgIdList.length - 2 < 0 ? 0 : msg.parentMsgIdList.length - 2]; //加入自身MsgId - let MultiMsgs = (await NTQQMsgApi.getMultiMsg(ParentMsgPeer, msg.parentMsgIdList[0], msg.msgId))?.msgList; + const MultiMsgs = (await NTQQMsgApi.getMultiMsg(ParentMsgPeer, msg.parentMsgIdList[0], msg.msgId))?.msgList; //拉取下级消息 if (!MultiMsgs) continue; //拉取失败则跳过 message_data['data']['content'] = []; - for (let MultiMsg of MultiMsgs) { + for (const MultiMsg of MultiMsgs) { //对每条拉取的消息传递ParentMsgPeer修正Peer MultiMsg.parentMsgPeer = ParentMsgPeer; MultiMsg.parentMsgIdList = msg.parentMsgIdList; MultiMsg.id = MessageUnique.createMsg(ParentMsgPeer, MultiMsg.msgId);//该ID仅用查看 无法调用 - let msgList = await OB11Constructor.message(MultiMsg); + const msgList = await OB11Constructor.message(MultiMsg); message_data['data']['content'].push(msgList); //console.log("合并消息", msgList); } diff --git a/src/onebot11/event/notice/OB11GroupAdminNoticeEvent.ts b/src/onebot11/event/notice/OB11GroupAdminNoticeEvent.ts index a968de43..1d4ef6b8 100644 --- a/src/onebot11/event/notice/OB11GroupAdminNoticeEvent.ts +++ b/src/onebot11/event/notice/OB11GroupAdminNoticeEvent.ts @@ -2,5 +2,5 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; export class OB11GroupAdminNoticeEvent extends OB11GroupNoticeEvent { notice_type = 'group_admin'; - sub_type: 'set' | 'unset' = "set"; // "set" | "unset" + sub_type: 'set' | 'unset' = 'set'; // "set" | "unset" } \ No newline at end of file diff --git a/src/onebot11/event/notice/OB11InputStatusEvent.ts b/src/onebot11/event/notice/OB11InputStatusEvent.ts index ba255bc3..f9caadcd 100644 --- a/src/onebot11/event/notice/OB11InputStatusEvent.ts +++ b/src/onebot11/event/notice/OB11InputStatusEvent.ts @@ -3,7 +3,7 @@ import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent'; export class OB11InputStatusEvent extends OB11BaseNoticeEvent { notice_type = 'notify'; sub_type = 'input_status'; - status_text = "对方正在输入..." + status_text = '对方正在输入...'; eventType = 1; user_id = 0; constructor(user_id: number, eventType: number, status_text: string) { diff --git a/src/onebot11/log.ts b/src/onebot11/log.ts index f95d9870..addef7af 100644 --- a/src/onebot11/log.ts +++ b/src/onebot11/log.ts @@ -26,7 +26,7 @@ export async function logMessage(ob11Message: OB11Message) { if (ob11Message.message_type === 'group') { if (ob11Message.group_id == 284840486) { group = await getGroup(ob11Message.group_id!); - prefix += `转发消息[外部来源] `; + prefix += '转发消息[外部来源] '; } else { group = await getGroup(ob11Message.group_id!); prefix += `群[${group?.groupName}(${ob11Message.group_id})] `; diff --git a/src/onebot11/main.ts b/src/onebot11/main.ts index a48d6762..7fa9b584 100644 --- a/src/onebot11/main.ts +++ b/src/onebot11/main.ts @@ -104,10 +104,10 @@ export class NapCatOnebot11 { toUin: string; } ) => { - let uin = await NTQQUserApi.getUinByUid(data.fromUin); + const uin = await NTQQUserApi.getUinByUid(data.fromUin); logNotice(`[输入状态] ${uin} ${data.statusText}`); postOB11Event(new OB11InputStatusEvent(parseInt(uin), data.eventType, data.statusText)); - } + }; msgListener.onRecvSysMsg = async (protobufData: number[]) => { // function buf2hex(buffer: Buffer) { // return [...new Uint8Array(buffer)]