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,
"type": "extension",
"name": "LLOneBot v3.13.4",
"name": "LLOneBot v3.13.5",
"slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi",
"version": "3.13.4",
"version": "3.13.5",
"thumbnail": "./icon.png",
"authors": [
{

View File

@ -21,7 +21,7 @@ class BaseAction<PayloadType, ReturnDataType> {
const resData = await this._handle(payload);
return OB11Response.ok(resData);
} catch (e) {
log("发生错误", e.stack)
log("发生错误", e)
return OB11Response.error(e.toString(), 200);
}
}
@ -35,7 +35,7 @@ class BaseAction<PayloadType, ReturnDataType> {
const resData = await this._handle(payload)
return OB11Response.ok(resData, echo);
} catch (e) {
log("发生错误", e.stack.toString())
log("发生错误", e)
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 {NTQQApi} from "../../ntqqapi/ntcall";
import {ActionName} from "./types";
import {log} from "../../common/utils";
interface Payload {
user_id: number,
@ -12,16 +13,16 @@ export default class SendLike extends BaseAction<Payload, null> {
actionName = ActionName.SendLike
protected async _handle(payload: Payload): Promise<null> {
const qq = payload.user_id.toString();
const friend = await getFriend(qq)
let uid: string;
if (!friend) {
uid = getUidByUin(qq)
}
else{
uid = friend.uid
}
log("点赞参数", payload)
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);
if (result.result !== 0) {
throw result.errMsg

View File

@ -305,7 +305,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
case OB11MessageDataType.reply: {
let replyMsgId = sendMsg.data.id;
if (replyMsgId) {
const replyMsg = await dbUtil.getMsgBySeqId(replyMsgId)
const replyMsg = await dbUtil.getMsgByShortId(parseInt(replyMsgId))
if (replyMsg) {
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);
wsReply(wsClient, handleResult)
} 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"