mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
refactor: rename all coreContext -> core
This commit is contained in:
@@ -19,11 +19,11 @@ type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GetCookies extends BaseAction<Payload, Response> {
|
||||
actionName = ActionName.GetCookies;
|
||||
PayloadSchema = SchemaData;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
const NTQQWebApi = this.CoreContext.apis.WebApi;
|
||||
const NTQQUserApi = this.core.apis.UserApi;
|
||||
const NTQQWebApi = this.core.apis.WebApi;
|
||||
// if (!payload.domain) {
|
||||
// throw new Error('缺少参数 domain');
|
||||
// }
|
||||
|
||||
@@ -15,11 +15,11 @@ const SchemaData = {
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
export default class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
||||
actionName = ActionName.GetFriendList;
|
||||
PayloadSchema = SchemaData;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
//全新逻辑
|
||||
const NTQQFriendApi = this.CoreContext.apis.FriendApi;
|
||||
const NTQQFriendApi = this.core.apis.FriendApi;
|
||||
return OB11Constructor.friendsV2(await NTQQFriendApi.getBuddyV2(typeof payload.no_cache === 'string' ? payload.no_cache === 'true' : !!payload.no_cache));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,17 +13,17 @@ type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class GetRecentContact extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GetRecentContact;
|
||||
PayloadSchema = SchemaData;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
const NTQQMsgApi = this.CoreContext.apis.MsgApi;
|
||||
const NTQQUserApi = this.core.apis.UserApi;
|
||||
const NTQQMsgApi = this.core.apis.MsgApi;
|
||||
const ret = await NTQQUserApi.getRecentContactListSnapShot(+(payload.count || 10));
|
||||
return await Promise.all(ret.info.changedList.map(async (t) => {
|
||||
const FastMsg = await NTQQMsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
|
||||
if (FastMsg.msgList.length > 0) {
|
||||
//扩展ret.info.changedList
|
||||
const lastestMsg = await this.OneBotContext.apiContext.MsgApi.parseMessage(FastMsg.msgList[0], 'array');
|
||||
const lastestMsg = await this.obContext.apiContext.MsgApi.parseMessage(FastMsg.msgList[0], 'array');
|
||||
return {
|
||||
lastestMsg: lastestMsg,
|
||||
peerUin: t.peerUin,
|
||||
|
||||
@@ -15,10 +15,10 @@ type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SendLike extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.SendLike;
|
||||
PayloadSchema = SchemaData;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload): Promise<null> {
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
const NTQQUserApi = this.core.apis.UserApi;
|
||||
//logDebug('点赞参数', payload);
|
||||
try {
|
||||
const qq = payload.user_id.toString();
|
||||
|
||||
@@ -16,10 +16,10 @@ type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetFriendAddRequest extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.SetFriendAddRequest;
|
||||
PayloadSchema = SchemaData;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload): Promise<null> {
|
||||
const NTQQFriendApi = this.CoreContext.apis.FriendApi;
|
||||
const NTQQFriendApi = this.core.apis.FriendApi;
|
||||
const approve = payload.approve?.toString() !== 'false';
|
||||
await NTQQFriendApi.handleFriendRequest(payload.flag, approve);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user