This commit is contained in:
手瓜一十雪 2024-11-14 12:48:19 +08:00
parent 756dea71fc
commit f425c9478e
6 changed files with 7 additions and 8 deletions

View File

@ -61,7 +61,7 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
}
const rootMsgId = MessageUnique.getShortIdByMsgId(msgId);
const rootMsg = MessageUnique.getMsgIdAndPeerByShortId(rootMsgId || parseInt(msgId));
const rootMsg = MessageUnique.getMsgIdAndPeerByShortId(rootMsgId ?? +msgId);
if (!rootMsg) {
throw new Error('msg not found');
}
@ -76,7 +76,7 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
if (!(resMsg?.message?.[0] as OB11MessageForward)?.data?.content) {
throw new Error('找不到相关的聊天记录');
}
return {
return {
messages: (resMsg?.message?.[0] as OB11MessageForward)?.data?.content
};
//}

View File

@ -14,7 +14,7 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>;
export class SetQQProfile extends BaseAction<Payload, any | null> {
export class SetQQProfile extends BaseAction<Payload, any> {
actionName = ActionName.SetQQProfile;
payloadSchema = SchemaData;

View File

@ -44,7 +44,7 @@ class GetGroupMemberInfo extends BaseAction<Payload, OB11GroupMember> {
} else {
this.core.context.logger.logDebug(`获取群成员详细信息失败, 只能返回基础信息`);
}
return OB11Entities.groupMember(payload.group_id.toString(), member as GroupMember);
return OB11Entities.groupMember(payload.group_id.toString(), member);
}
}

View File

@ -1,4 +1,3 @@
import { OB11Group } from '@/onebot';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';

View File

@ -28,7 +28,7 @@ class GetMsg extends BaseAction<Payload, OB11Message> {
throw Error('参数message_id不能为空');
}
const MsgShortId = MessageUnique.getShortIdByMsgId(payload.message_id.toString());
const msgIdWithPeer = MessageUnique.getMsgIdAndPeerByShortId(MsgShortId || parseInt(payload.message_id.toString()));
const msgIdWithPeer = MessageUnique.getMsgIdAndPeerByShortId(MsgShortId ?? +payload.message_id);
if (!msgIdWithPeer) {
throw new Error('消息不存在');
}

View File

@ -68,7 +68,7 @@ export async function createContext(core: NapCatCore, payload: OB11PostContext,
}
return {
chatType: ChatType.KCHATTYPEC2C,
peerUid: Uid!,
peerUid: Uid,
guildId: '',
};
}
@ -175,7 +175,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
if (getSpecialMsgNum({ message: OB11Data }, OB11MessageDataType.node)) {
const uploadReturnData = await this.uploadForwardedNodesPacket(msgPeer, OB11Data as OB11MessageNode[], node.data.source, node.data.news, node.data.summary, node.data.prompt, {
user_id: (node.data.user_id || node.data.uin)?.toString() ?? parentMeta?.user_id ?? this.core.selfInfo.uin,
user_id: (node.data.user_id ?? node.data.uin)?.toString() ?? parentMeta?.user_id ?? this.core.selfInfo.uin,
nickname: (node.data.nickname || node.data.name) ?? parentMeta?.nickname ?? "QQ用户",
}, dp + 1);
sendElements = uploadReturnData?.finallySendElements ? [uploadReturnData.finallySendElements] : [];