fix: can not send reply msg

fix: send like return error
This commit is contained in:
linyuchen 2024-03-07 15:34:09 +08:00
parent 55d046b4f9
commit ba8ed36c6a
6 changed files with 17 additions and 16 deletions

View File

@ -1,10 +1,10 @@
{ {
"manifest_version": 4, "manifest_version": 4,
"type": "extension", "type": "extension",
"name": "LLOneBot v3.13.4", "name": "LLOneBot v3.13.5",
"slug": "LLOneBot", "slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi", "description": "LiteLoaderQQNT的OneBotApi",
"version": "3.13.4", "version": "3.13.5",
"thumbnail": "./icon.png", "thumbnail": "./icon.png",
"authors": [ "authors": [
{ {

View File

@ -21,7 +21,7 @@ class BaseAction<PayloadType, ReturnDataType> {
const resData = await this._handle(payload); const resData = await this._handle(payload);
return OB11Response.ok(resData); return OB11Response.ok(resData);
} catch (e) { } catch (e) {
log("发生错误", e.stack) log("发生错误", e)
return OB11Response.error(e.toString(), 200); return OB11Response.error(e.toString(), 200);
} }
} }
@ -35,7 +35,7 @@ class BaseAction<PayloadType, ReturnDataType> {
const resData = await this._handle(payload) const resData = await this._handle(payload)
return OB11Response.ok(resData, echo); return OB11Response.ok(resData, echo);
} catch (e) { } catch (e) {
log("发生错误", e.stack.toString()) log("发生错误", e)
return OB11Response.error(e.toString(), 1200, echo) return OB11Response.error(e.toString(), 1200, echo)
} }
} }

View File

@ -2,6 +2,7 @@ import BaseAction from "./BaseAction";
import {getFriend, getUidByUin, uidMaps} from "../../common/data"; import {getFriend, getUidByUin, uidMaps} from "../../common/data";
import {NTQQApi} from "../../ntqqapi/ntcall"; import {NTQQApi} from "../../ntqqapi/ntcall";
import {ActionName} from "./types"; import {ActionName} from "./types";
import {log} from "../../common/utils";
interface Payload { interface Payload {
user_id: number, user_id: number,
@ -12,16 +13,16 @@ export default class SendLike extends BaseAction<Payload, null> {
actionName = ActionName.SendLike actionName = ActionName.SendLike
protected async _handle(payload: Payload): Promise<null> { protected async _handle(payload: Payload): Promise<null> {
const qq = payload.user_id.toString(); log("点赞参数", payload)
const friend = await getFriend(qq)
let uid: string;
if (!friend) {
uid = getUidByUin(qq)
}
else{
uid = friend.uid
}
try { try {
const qq = payload.user_id.toString();
const friend = await getFriend(qq)
let uid: string;
if (!friend) {
uid = getUidByUin(qq)
} else {
uid = friend.uid
}
let result = await NTQQApi.likeFriend(uid, parseInt(payload.times?.toString()) || 1); let result = await NTQQApi.likeFriend(uid, parseInt(payload.times?.toString()) || 1);
if (result.result !== 0) { if (result.result !== 0) {
throw result.errMsg throw result.errMsg

View File

@ -305,7 +305,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
case OB11MessageDataType.reply: { case OB11MessageDataType.reply: {
let replyMsgId = sendMsg.data.id; let replyMsgId = sendMsg.data.id;
if (replyMsgId) { if (replyMsgId) {
const replyMsg = await dbUtil.getMsgBySeqId(replyMsgId) const replyMsg = await dbUtil.getMsgByShortId(parseInt(replyMsgId))
if (replyMsg) { if (replyMsg) {
sendElements.push(SendMsgElementConstructor.reply(replyMsg.msgSeq, replyMsg.msgId, replyMsg.senderUin, replyMsg.senderUin)) sendElements.push(SendMsgElementConstructor.reply(replyMsg.msgSeq, replyMsg.msgId, replyMsg.senderUin, replyMsg.senderUin))
} }

View File

@ -28,7 +28,7 @@ class OB11WebsocketServer extends WebsocketServerBase {
let handleResult = await action.websocketHandle(params, echo); let handleResult = await action.websocketHandle(params, echo);
wsReply(wsClient, handleResult) wsReply(wsClient, handleResult)
} catch (e) { } catch (e) {
wsReply(wsClient, OB11Response.error(`api处理出错:${e}`, 1200, echo)) wsReply(wsClient, OB11Response.error(`api处理出错:${e.stack}`, 1200, echo))
} }
} }

View File

@ -1 +1 @@
export const version = "3.13.4" export const version = "3.13.5"