mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-03-02 00:30:25 +00:00
style: 强类型大法
This commit is contained in:
@@ -10,16 +10,16 @@ const SchemaData = Type.Object({
|
||||
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
|
||||
export default class GetRecentContact extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.GetRecentContact;
|
||||
payloadSchema = SchemaData;
|
||||
export default class GetRecentContact extends OneBotAction<Payload, unknown> {
|
||||
override actionName = ActionName.GetRecentContact;
|
||||
override payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload, adapter: string, config: NetworkAdapterConfig) {
|
||||
async _handle(payload: Payload, _adapter: string, config: NetworkAdapterConfig) {
|
||||
const ret = await this.core.apis.UserApi.getRecentContactListSnapShot(+payload.count);
|
||||
//烘焙消息
|
||||
return await Promise.all(ret.info.changedList.map(async (t) => {
|
||||
const FastMsg = await this.core.apis.MsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
|
||||
if (FastMsg.msgList.length > 0) {
|
||||
if (FastMsg.msgList.length > 0 && FastMsg.msgList[0]) {
|
||||
//扩展ret.info.changedList
|
||||
const lastestMsg = await this.obContext.apis.MsgApi.parseMessage(FastMsg.msgList[0], config.messagePostFormat);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user