style: fix

This commit is contained in:
手瓜一十雪 2024-08-26 00:17:42 +08:00
parent fc73295520
commit 9da714bf15
9 changed files with 40 additions and 43 deletions

View File

@ -319,30 +319,30 @@ export class NTQQFileApi {
filePath: string filePath: string
}) => Promise<unknown>, }) => Promise<unknown>,
(fileTransNotifyInfo: OnRichMediaDownloadCompleteParams) => void (fileTransNotifyInfo: OnRichMediaDownloadCompleteParams) => void
>( >(
'NodeIKernelMsgService/downloadRichMedia', 'NodeIKernelMsgService/downloadRichMedia',
'NodeIKernelMsgListener/onRichMediaDownloadComplete', 'NodeIKernelMsgListener/onRichMediaDownloadComplete',
1, 1,
timeout, timeout,
(arg: OnRichMediaDownloadCompleteParams) => { (arg: OnRichMediaDownloadCompleteParams) => {
if (arg.msgId === msgId) { if (arg.msgId === msgId) {
return true; return true;
} }
return false; return false;
}, },
{ {
fileModelId: '0', fileModelId: '0',
downloadSourceType: 0, downloadSourceType: 0,
triggerType: 1, triggerType: 1,
msgId: msgId, msgId: msgId,
chatType: chatType, chatType: chatType,
peerUid: peerUid, peerUid: peerUid,
elementId: elementId, elementId: elementId,
thumbSize: 0, thumbSize: 0,
downloadType: 1, downloadType: 1,
filePath: thumbPath, filePath: thumbPath,
}, },
); );
const msg = await this.core.apis.MsgApi.getMsgsByMsgId({ const msg = await this.core.apis.MsgApi.getMsgsByMsgId({
guildId: '', guildId: '',
chatType: chatType, chatType: chatType,
@ -482,10 +482,10 @@ export class NTQQFileApi {
let id = ''; let id = '';
const Listener = this.core.eventWrapper.RegisterListen<(params: OnListener) => void> const Listener = this.core.eventWrapper.RegisterListen<(params: OnListener) => void>
( (
'NodeIKernelSearchListener/onSearchFileKeywordsResult', 'NodeIKernelSearchListener/onSearchFileKeywordsResult',
1, 1,
20000, 20000,
(params) => id !== '' && params.searchId == id, (params) => id !== '' && params.searchId == id,
); );
id = await Event!(keys, 12); id = await Event!(keys, 12);
const [ret] = (await Listener); const [ret] = (await Listener);

View File

@ -17,7 +17,7 @@ export class FetchCustomFace extends BaseAction<Payload, string[]> {
async _handle(payload: Payload) { async _handle(payload: Payload) {
//48 可能正好是QQ需要的一个页面的数量 Tagged Mlikiowa //48 可能正好是QQ需要的一个页面的数量 Tagged Mlikiowa
const ret = await this.CoreContext.apis.MsgApi.fetchFavEmojiList(parseInt((payload.count || '0').toString()) || 48); const ret = await this.CoreContext.apis.MsgApi.fetchFavEmojiList(+(payload.count ?? 48));
return ret.emojiInfoList.map(e => e.url); return ret.emojiInfoList.map(e => e.url);
} }
} }

View File

@ -27,6 +27,6 @@ export class FetchEmojiLike extends BaseAction<Payload, any> {
const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
if (!msgIdPeer) throw new Error('消息不存在'); if (!msgIdPeer) throw new Error('消息不存在');
const msg = (await NTQQMsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0]; const msg = (await NTQQMsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0];
return await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer, msg.msgSeq, payload.emojiId, payload.emojiType, parseInt((payload.count || '0').toString()) || 20); return await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer, msg.msgSeq, payload.emojiId, payload.emojiType, +(payload.count ?? 20));
} }
} }

View File

@ -18,6 +18,6 @@ export class GetCollectionList extends BaseAction<Payload, any> {
PayloadSchema = SchemaData; PayloadSchema = SchemaData;
async _handle(payload: Payload) { async _handle(payload: Payload) {
const NTQQCollectionApi = this.CoreContext.apis.CollectionApi; const NTQQCollectionApi = this.CoreContext.apis.CollectionApi;
return await NTQQCollectionApi.getAllCollection(parseInt(payload.category.toString()), parseInt(payload.count.toString())); return await NTQQCollectionApi.getAllCollection(parseInt(payload.category.toString()), +(payload.count ?? 1));
} }
} }

View File

@ -14,7 +14,7 @@ const SchemaData = {
properties: { properties: {
user_id: { type: ['number', 'string'] }, user_id: { type: ['number', 'string'] },
message_seq: { type: 'number' }, message_seq: { type: 'number' },
count: { type: 'number' }, count: { type: ['number', 'string'] },
reverseOrder: { type: 'boolean' }, reverseOrder: { type: 'boolean' },
}, },
required: ['user_id'], required: ['user_id'],
@ -32,7 +32,7 @@ export default class GetFriendMsgHistory extends BaseAction<Payload, Response> {
const NTQQFriendApi = this.CoreContext.apis.FriendApi; const NTQQFriendApi = this.CoreContext.apis.FriendApi;
//处理参数 //处理参数
const uid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString()); const uid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
const MsgCount = payload.count || 20; const MsgCount = +(payload.count ?? 20);
const isReverseOrder = payload.reverseOrder || true; const isReverseOrder = payload.reverseOrder || true;
if (!uid) throw `记录${payload.user_id}不存在`; if (!uid) throw `记录${payload.user_id}不存在`;
const friend = await NTQQFriendApi.isBuddy(uid); const friend = await NTQQFriendApi.isBuddy(uid);

View File

@ -14,7 +14,7 @@ const SchemaData = {
properties: { properties: {
group_id: { type: ['number', 'string'] }, group_id: { type: ['number', 'string'] },
message_seq: { type: 'number' }, message_seq: { type: 'number' },
count: { type: 'number' }, count: { type: ['number', 'string'] },
reverseOrder: { type: 'boolean' }, reverseOrder: { type: 'boolean' },
}, },
required: ['group_id'], required: ['group_id'],
@ -30,7 +30,7 @@ export default class GoCQHTTPGetGroupMsgHistory extends BaseAction<Payload, Resp
const NTQQMsgApi = this.CoreContext.apis.MsgApi; const NTQQMsgApi = this.CoreContext.apis.MsgApi;
//处理参数 //处理参数
const isReverseOrder = payload.reverseOrder || true; const isReverseOrder = payload.reverseOrder || true;
const MsgCount = payload.count || 20; const MsgCount = +(payload.count ?? 20);
const peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: payload.group_id.toString() }; const peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: payload.group_id.toString() };
//拉取消息 //拉取消息
let msgList: RawMessage[]; let msgList: RawMessage[];

View File

@ -62,8 +62,6 @@ export class SendGroupNotice extends BaseAction<Payload, null> {
if (PublishGroupBulletinResult.result != 0) { if (PublishGroupBulletinResult.result != 0) {
throw `设置群公告失败,错误信息:${PublishGroupBulletinResult.errMsg}`; throw `设置群公告失败,错误信息:${PublishGroupBulletinResult.errMsg}`;
} }
// 下面实现扬了
//await WebApi.setGroupNotice(payload.group_id, payload.content) ;
return null; return null;
} }
} }

View File

@ -18,7 +18,7 @@ export default class GetRecentContact extends BaseAction<Payload, any> {
async _handle(payload: Payload) { async _handle(payload: Payload) {
const NTQQUserApi = this.CoreContext.apis.UserApi; const NTQQUserApi = this.CoreContext.apis.UserApi;
const NTQQMsgApi = this.CoreContext.apis.MsgApi; const NTQQMsgApi = this.CoreContext.apis.MsgApi;
const ret = await NTQQUserApi.getRecentContactListSnapShot(parseInt((payload.count || 10).toString())); const ret = await NTQQUserApi.getRecentContactListSnapShot(+(payload.count || 10));
return await Promise.all(ret.info.changedList.map(async (t) => { return await Promise.all(ret.info.changedList.map(async (t) => {
const FastMsg = await NTQQMsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]); const FastMsg = await NTQQMsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
if (FastMsg.msgList.length > 0) { if (FastMsg.msgList.length > 0) {

View File

@ -21,8 +21,7 @@ import {
OB11MessageData, OB11MessageData,
OB11MessageDataType, OB11MessageDataType,
OB11MessageFileBase, OB11MessageFileBase,
OB11MessageForward, OB11MessageForward
OB11MessageReply,
} from '@/onebot'; } from '@/onebot';
import { OB11Constructor } from '../helper'; import { OB11Constructor } from '../helper';
import { EventType } from '@/onebot/event/OB11BaseEvent'; import { EventType } from '@/onebot/event/OB11BaseEvent';
@ -447,8 +446,8 @@ export class OneBotMsgApi {
replyElement: { replyElement: {
replayMsgSeq: replyMsg.msgSeq, // raw.msgSeq replayMsgSeq: replyMsg.msgSeq, // raw.msgSeq
replayMsgId: replyMsg.msgId, // raw.msgId replayMsgId: replyMsg.msgId, // raw.msgId
senderUin: replyMsg.senderUin!, senderUin: replyMsg.senderUin,
senderUinStr: replyMsg.senderUin!, senderUinStr: replyMsg.senderUin,
}, },
} : } :
undefined; undefined;
@ -793,6 +792,6 @@ export class OneBotMsgApi {
deleteAfterSentFiles.push(path); deleteAfterSentFiles.push(path);
} }
return { path, fileName: inputdata.name || fileName }; return { path, fileName: inputdata.name ?? fileName };
} }
} }