mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
chore: extend get兼容
This commit is contained in:
parent
47cafd295b
commit
5770fc02a1
@ -5,7 +5,7 @@ import { ActionName } from '../types';
|
|||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
count: { type: 'number' },
|
count: { type: ['number', 'string'] },
|
||||||
},
|
},
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
@ -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(payload.count || 48);
|
const ret = await this.CoreContext.apis.MsgApi.fetchFavEmojiList(parseInt((payload.count || '0').toString()) || 48);
|
||||||
return ret.emojiInfoList.map(e => e.url);
|
return ret.emojiInfoList.map(e => e.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ const SchemaData = {
|
|||||||
emojiId: { type: 'string' },
|
emojiId: { type: 'string' },
|
||||||
emojiType: { type: 'string' },
|
emojiType: { type: 'string' },
|
||||||
message_id: { type: ['string', 'number'] },
|
message_id: { type: ['string', 'number'] },
|
||||||
count: { type: 'number' },
|
count: { type: ['string', 'number'] },
|
||||||
},
|
},
|
||||||
required: ['emojiId', 'emojiType', 'message_id'],
|
required: ['emojiId', 'emojiType', 'message_id'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
@ -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, payload.count);
|
return await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer, msg.msgSeq, payload.emojiId, payload.emojiType, parseInt((payload.count || '0').toString()) || 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
category: { type: 'number' },
|
category: { type: ['number', 'string'] },
|
||||||
count: { type: 'number' },
|
count: { type: ['number', 'string'] },
|
||||||
},
|
},
|
||||||
required: ['category', 'count'],
|
required: ['category', 'count'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
@ -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(payload.category, payload.count);
|
return await NTQQCollectionApi.getAllCollection(parseInt(payload.category.toString()), parseInt(payload.count.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
status: { type: 'number' },
|
status: { type: ['number', 'string'] },
|
||||||
extStatus: { type: 'number' },
|
extStatus: { type: ['number', 'string'] },
|
||||||
batteryStatus: { type: 'number' },
|
batteryStatus: { type: ['number', 'string'] },
|
||||||
},
|
},
|
||||||
required: ['status', 'extStatus', 'batteryStatus'],
|
required: ['status', 'extStatus', 'batteryStatus'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
@ -20,14 +20,12 @@ export class SetOnlineStatus extends BaseAction<Payload, null> {
|
|||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
// 可设置状态
|
|
||||||
// { status: 10, extStatus: 1027, batteryStatus: 0 }
|
|
||||||
// { status: 30, extStatus: 0, batteryStatus: 0 }
|
|
||||||
// { status: 50, extStatus: 0, batteryStatus: 0 }
|
|
||||||
// { status: 60, extStatus: 0, batteryStatus: 0 }
|
|
||||||
// { status: 70, extStatus: 0, batteryStatus: 0 }
|
|
||||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||||
const ret = await NTQQUserApi.setSelfOnlineStatus(payload.status, payload.extStatus, payload.batteryStatus);
|
const ret = await NTQQUserApi.setSelfOnlineStatus(
|
||||||
|
parseInt(payload.status.toString()),
|
||||||
|
parseInt(payload.extStatus.toString()),
|
||||||
|
parseInt(payload.batteryStatus.toString())
|
||||||
|
);
|
||||||
if (ret.result !== 0) {
|
if (ret.result !== 0) {
|
||||||
throw new Error('设置在线状态失败');
|
throw new Error('设置在线状态失败');
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ const SchemaData = {
|
|||||||
properties: {
|
properties: {
|
||||||
nick: { type: 'string' },
|
nick: { type: 'string' },
|
||||||
longNick: { type: 'string' },
|
longNick: { type: 'string' },
|
||||||
sex: { type: 'number' },//传Sex值?建议传0
|
sex: { type: ['number', 'string'] },//传Sex值?建议传0
|
||||||
},
|
},
|
||||||
required: ['nick', 'longNick', 'sex'],
|
required: ['nick', 'longNick', 'sex'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
@ -23,7 +23,7 @@ export class SetSelfProfile extends BaseAction<Payload, any | null> {
|
|||||||
const ret = await NTQQUserApi.modifySelfProfile({
|
const ret = await NTQQUserApi.modifySelfProfile({
|
||||||
nick: payload.nick,
|
nick: payload.nick,
|
||||||
longNick: payload.longNick,
|
longNick: payload.longNick,
|
||||||
sex: payload.sex,
|
sex: parseInt(payload.sex.toString()),
|
||||||
birthday: { birthday_year: '', birthday_month: '', birthday_day: '' },
|
birthday: { birthday_year: '', birthday_month: '', birthday_day: '' },
|
||||||
location: undefined,
|
location: undefined,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user