diff --git a/src/common/file.ts b/src/common/file.ts index bb5f3a23..b918c4d6 100644 --- a/src/common/file.ts +++ b/src/common/file.ts @@ -216,7 +216,7 @@ export async function checkUriType(Uri: string) { return { Uri: filePath, Type: FileUriType.Local }; } if (uri.startsWith('data:')) { - let data = uri.split(',')[1]; + const data = uri.split(',')[1]; if (data) return { Uri: data, Type: FileUriType.Base64 }; } }, Uri); diff --git a/src/onebot/action/group/GetGroupEssence.ts b/src/onebot/action/group/GetGroupEssence.ts index 81ec068e..9e809ab4 100644 --- a/src/onebot/action/group/GetGroupEssence.ts +++ b/src/onebot/action/group/GetGroupEssence.ts @@ -51,7 +51,7 @@ export class GetGroupEssence extends BaseAction { operator_nick: msg.add_digest_nick, message_id: message_id, operator_time: msg.add_digest_time, - content: (await this.obContext.apis.MsgApi.parseMessage(rawMessage, 'array'))?.message + content: (await this.obContext.apis.MsgApi.parseMessage(rawMessage))?.message }; } const msgTempData = JSON.stringify({ diff --git a/src/onebot/action/msg/GetMsg.ts b/src/onebot/action/msg/GetMsg.ts index dae3b347..40f0251e 100644 --- a/src/onebot/action/msg/GetMsg.ts +++ b/src/onebot/action/msg/GetMsg.ts @@ -35,7 +35,7 @@ class GetMsg extends BaseAction { const msg = await this.core.apis.MsgApi.getMsgsByMsgId( peer, [msgIdWithPeer?.MsgId || payload.message_id.toString()]); - const retMsg = await this.obContext.apis.MsgApi.parseMessage(msg.msgList[0], 'array'); + const retMsg = await this.obContext.apis.MsgApi.parseMessage(msg.msgList[0]); if (!retMsg) throw Error('消息为空'); try { retMsg.message_id = MessageUnique.createUniqueMsgId(peer, msg.msgList[0].msgId)!; diff --git a/src/onebot/action/user/GetRecentContact.ts b/src/onebot/action/user/GetRecentContact.ts index cbee7db9..9a9487fe 100644 --- a/src/onebot/action/user/GetRecentContact.ts +++ b/src/onebot/action/user/GetRecentContact.ts @@ -21,7 +21,7 @@ export default class GetRecentContact extends BaseAction { const FastMsg = await this.core.apis.MsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]); if (FastMsg.msgList.length > 0) { //扩展ret.info.changedList - const lastestMsg = await this.obContext.apis.MsgApi.parseMessage(FastMsg.msgList[0], 'array'); + const lastestMsg = await this.obContext.apis.MsgApi.parseMessage(FastMsg.msgList[0]); return { lastestMsg: lastestMsg, peerUin: t.peerUin, diff --git a/src/onebot/api/group.ts b/src/onebot/api/group.ts index 500ba0a8..0786674f 100644 --- a/src/onebot/api/group.ts +++ b/src/onebot/api/group.ts @@ -78,8 +78,8 @@ export class OneBotGroupApi { id: FileNapCatOneBotUUID.encode({ chatType: ChatType.KCHATTYPEGROUP, peerUid: msg.peerUid, - }, msg.msgId, element.elementId, "."+element.fileElement.fileName), - url: pathToFileURL(element.fileElement.filePath), + }, msg.msgId, element.elementId, "." + element.fileElement.fileName), + url: pathToFileURL(element.fileElement.filePath).href, name: element.fileElement.fileName, size: parseInt(element.fileElement.fileSize), busid: element.fileElement.fileBizId || 0, diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index e819d821..bf68f341 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -137,7 +137,7 @@ export class OneBotMsgApi { data: { file: element.fileName, path: element.filePath, - url: pathToFileURL(element.filePath), + url: pathToFileURL(element.filePath).href, file_id: FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "."+element.fileName), file_size: element.fileSize, file_unique: element.fileName, @@ -177,9 +177,9 @@ export class OneBotMsgApi { peerUid: msg.peerUid, guildId: '', }; - const { emojiId } = _; - const dir = emojiId.substring(0, 2); - const url = `https://gxh.vip.qq.com/club/item/parcel/item/${dir}/${emojiId}/raw300.gif` + const { emojiId } = _; + const dir = emojiId.substring(0, 2); + const url = `https://gxh.vip.qq.com/club/item/parcel/item/${dir}/${emojiId}/raw300.gif`; return { type: OB11MessageDataType.image, data: { @@ -262,13 +262,13 @@ export class OneBotMsgApi { if (!videoDownUrl) { videoDownUrl = element.filePath; } - const fileCode = FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "."+element.fileName) + const fileCode = FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "."+element.fileName); return { type: OB11MessageDataType.video, data: { file: fileCode, path: videoDownUrl, - url: videoDownUrl ?? pathToFileURL(element.filePath), + url: videoDownUrl ?? pathToFileURL(element.filePath).href, file_id: fileCode, file_size: element.fileSize, file_unique: element.fileName, @@ -288,7 +288,7 @@ export class OneBotMsgApi { data: { file: fileCode, path: element.filePath, - url: pathToFileURL(element.filePath), + url: pathToFileURL(element.filePath).href, file_id: fileCode, file_size: element.fileSize, file_unique: element.fileName diff --git a/src/onebot/types/message.ts b/src/onebot/types/message.ts index 5bc63fc7..0e50a95f 100644 --- a/src/onebot/types/message.ts +++ b/src/onebot/types/message.ts @@ -84,6 +84,7 @@ export interface OB11MessageText { export interface OB11MessageFileBase { data: { + file_unique?:string, path?: string; thumb?: string; name?: string; diff --git a/src/shell/napcat.ts b/src/shell/napcat.ts index 88c774a8..bef7f21b 100644 --- a/src/shell/napcat.ts +++ b/src/shell/napcat.ts @@ -150,7 +150,7 @@ export async function NCoreInitShell() { }; loginService.addKernelLoginListener(proxiedListenerOf(loginListener, logger) as any); - let isConnect = loginService.connect(); + const isConnect = loginService.connect(); if (!isConnect) { logger.logError('核心登录服务连接失败!'); return; @@ -204,7 +204,7 @@ export async function NCoreInitShell() { logger.log(`可用于快速登录的 QQ:\n${historyLoginList .map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`) .join('\n') - }`); + }`); } loginService.getQRCodePicture(); }