mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: can not send reply msg
fix: send like return error
This commit is contained in:
parent
55d046b4f9
commit
ba8ed36c6a
@ -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": [
|
||||
{
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
export const version = "3.13.4"
|
||||
export const version = "3.13.5"
|
Loading…
x
Reference in New Issue
Block a user