diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index a5a4f167..1c00a8df 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -147,7 +147,7 @@ export class NTQQFileApi { } catch (e) { logger.logError('获取视频信息失败,将使用默认值', e); } - let newFilePath = filePath + '.mp4'; + const newFilePath = filePath + '.mp4'; fs.renameSync(filePath, newFilePath); filePath = newFilePath; const { fileName: _fileName, path, fileSize, md5 } = await this.core.apis.FileApi.uploadFile(filePath, ElementType.VIDEO); diff --git a/src/core/helper/rkey.ts b/src/core/helper/rkey.ts index 89517e21..4806baf2 100644 --- a/src/core/helper/rkey.ts +++ b/src/core/helper/rkey.ts @@ -40,7 +40,7 @@ export class RkeyManager { async refreshRkey(): Promise { //刷新rkey - for (let url of this.serverUrl) { + for (const url of this.serverUrl) { try { this.rkeyData = await RequestUtil.HttpGetJson(url, 'GET'); } catch (e) { diff --git a/src/onebot/action/go-cqhttp/UploadGroupFile.ts b/src/onebot/action/go-cqhttp/UploadGroupFile.ts index 755ca2d0..3fc5005b 100644 --- a/src/onebot/action/go-cqhttp/UploadGroupFile.ts +++ b/src/onebot/action/go-cqhttp/UploadGroupFile.ts @@ -37,10 +37,10 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction { if (!downloadResult.success) { throw new Error(downloadResult.errMsg); } - let msgContext: MessageContext = { + const msgContext: MessageContext = { peer: peer, deleteAfterSentFiles: [] - } + }; const sendFileEle = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name, payload.folder_id); await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, [sendFileEle], [], true); return null; diff --git a/src/onebot/action/go-cqhttp/UploadPrivateFile.ts b/src/onebot/action/go-cqhttp/UploadPrivateFile.ts index ebba2ad6..856e32b2 100644 --- a/src/onebot/action/go-cqhttp/UploadPrivateFile.ts +++ b/src/onebot/action/go-cqhttp/UploadPrivateFile.ts @@ -45,13 +45,13 @@ export default class GoCQHTTPUploadPrivateFile extends BaseAction throw new Error(downloadResult.errMsg); } - let msgContext: MessageContext = { + const msgContext: MessageContext = { peer: await createContext(this.core, { user_id: payload.user_id.toString(), group_id: undefined, }, ContextMode.Private), deleteAfterSentFiles: [] - } + }; const sendFileEle: SendFileElement = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name); await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(await this.getPeer(payload), [sendFileEle], [], true); return null; diff --git a/src/onebot/api/group.ts b/src/onebot/api/group.ts index 8e6f9499..fb2d646f 100644 --- a/src/onebot/api/group.ts +++ b/src/onebot/api/group.ts @@ -142,22 +142,22 @@ export class OneBotGroupApi { //下面得改 上面也是错的grayTipElement.subElementType == GrayTipElementSubType.MEMBER_NEW_TITLE const type = json.items[json.items.length - 1]?.txt; switch (type) { - case "头衔": { - const memberUin = json.items[1].param[0]; - const title = json.items[3].txt; - logger.logDebug('收到群成员新头衔消息', json); - return new OB11GroupTitleEvent( - this.core, - parseInt(msg.peerUid), - parseInt(memberUin), - title, - ); - }; - case "移出": - logger.logDebug('收到机器人被踢消息', json); - return; - default: - logger.logWarn('收到未知的灰条消息', json); + case "头衔": { + const memberUin = json.items[1].param[0]; + const title = json.items[3].txt; + logger.logDebug('收到群成员新头衔消息', json); + return new OB11GroupTitleEvent( + this.core, + parseInt(msg.peerUid), + parseInt(memberUin), + title, + ); + } + case "移出": + logger.logDebug('收到机器人被踢消息', json); + return; + default: + logger.logWarn('收到未知的灰条消息', json); } } } diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index a29c1466..a2a6a156 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -819,7 +819,7 @@ export class OneBotMsgApi { return { path, fileName: inputdata.name ?? fileName }; } - async parseSysMessage(msg: number[]) { + async parseSysMessage(msg: number[]) { const sysMsg = SysMessage.decode(Uint8Array.from(msg)) as unknown as SysMessageType; if (sysMsg.msgSpec.length === 0) { return; @@ -827,9 +827,9 @@ export class OneBotMsgApi { const { msgType, subType, subSubType } = sysMsg.msgSpec[0]; if (msgType === 528 && subType === 39 && subSubType === 39) { if (!sysMsg.bodyWrapper) return; - let event = await this.obContext.apis.UserApi.parseLikeEvent(sysMsg.bodyWrapper.wrappedBody); + const event = await this.obContext.apis.UserApi.parseLikeEvent(sysMsg.bodyWrapper.wrappedBody); return event; - }; + } /* if (msgType === 732 && subType === 16 && subSubType === 16) { const greyTip = GreyTipWrapper.fromBinary(Uint8Array.from(sysMsg.bodyWrapper!.wrappedBody.slice(7))); diff --git a/src/onebot/network/passive-websocket.ts b/src/onebot/network/passive-websocket.ts index 0f4e5c61..115a432a 100644 --- a/src/onebot/network/passive-websocket.ts +++ b/src/onebot/network/passive-websocket.ts @@ -47,7 +47,7 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter { } //鉴权 this.authorize(token, wsClient, wsReq); - let paramUrl = wsReq.url?.indexOf('?') !== -1 ? wsReq.url?.substring(0, wsReq.url?.indexOf('?')) : wsReq.url; + const paramUrl = wsReq.url?.indexOf('?') !== -1 ? wsReq.url?.substring(0, wsReq.url?.indexOf('?')) : wsReq.url; const isEventConnect = paramUrl === '/event' || paramUrl === '' || paramUrl === '/'; if (isEventConnect) { this.connectEvent(core, wsClient);