mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-12 07:50:25 +00:00
refactor: inline getApiContext()
This commit is contained in:
@@ -22,8 +22,8 @@ export class GetCookies extends BaseAction<Payload, Response> {
|
||||
PayloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
|
||||
const NTQQWebApi = this.CoreContext.getApiContext().WebApi;
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
const NTQQWebApi = this.CoreContext.apis.WebApi;
|
||||
// if (!payload.domain) {
|
||||
// throw new Error('缺少参数 domain');
|
||||
// }
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
//全新逻辑
|
||||
const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi;
|
||||
const NTQQFriendApi = this.CoreContext.apis.FriendApi;
|
||||
return OB11Constructor.friendsV2(await NTQQFriendApi.getBuddyV2(payload?.no_cache === true || payload?.no_cache === 'true'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ export default class GetRecentContact extends BaseAction<Payload, any> {
|
||||
PayloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
|
||||
const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi;
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
const NTQQMsgApi = this.CoreContext.apis.MsgApi;
|
||||
const ret = await NTQQUserApi.getRecentContactListSnapShot(parseInt((payload.count || 10).toString()));
|
||||
const data = await Promise.all(ret.info.changedList.map(async (t) => {
|
||||
const FastMsg = await NTQQMsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
|
||||
|
||||
@@ -18,7 +18,7 @@ export default class SendLike extends BaseAction<Payload, null> {
|
||||
PayloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload): Promise<null> {
|
||||
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
//logDebug('点赞参数', payload);
|
||||
try {
|
||||
const qq = payload.user_id.toString();
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class SetFriendAddRequest extends BaseAction<Payload, null> {
|
||||
PayloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload): Promise<null> {
|
||||
const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi;
|
||||
const NTQQFriendApi = this.CoreContext.apis.FriendApi;
|
||||
const approve = payload.approve?.toString() !== 'false';
|
||||
await NTQQFriendApi.handleFriendRequest(payload.flag, approve);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user