fix: method signature of _handle

This commit is contained in:
Wesley F. Young
2024-08-10 22:22:52 +08:00
parent ad7dc3b6b5
commit bde27518c8
69 changed files with 97 additions and 78 deletions

View File

@@ -17,7 +17,7 @@ export class CreateCollection extends BaseAction<Payload, any> {
actionName = ActionName.CreateCollection;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
return await this.CoreContext.getApiContext().CollectionApi.createCollection(
this.CoreContext.selfInfo.uin,
this.CoreContext.selfInfo.uid,

View File

@@ -15,7 +15,7 @@ export class FetchCustomFace extends BaseAction<Payload, string[]> {
actionName = ActionName.FetchCustomFace;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
//48 可能正好是QQ需要的一个页面的数量 Tagged Mlikiowa
const ret = await this.CoreContext.getApiContext().MsgApi.fetchFavEmojiList(payload.count || 48);
return ret.emojiInfoList.map(e => e.url);

View File

@@ -23,7 +23,7 @@ export class FetchEmojiLike extends BaseAction<Payload, any> {
actionName = ActionName.FetchEmojiLike;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi;
const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
if (!msgIdPeer) throw new Error('消息不存在');

View File

@@ -17,7 +17,7 @@ export class GetCollectionList extends BaseAction<Payload, any> {
actionName = ActionName.GetCollectionList;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
const NTQQCollectionApi = this.CoreContext.getApiContext().CollectionApi;
return await NTQQCollectionApi.getAllCollection(payload.category, payload.count);
}

View File

@@ -5,7 +5,7 @@ import { OB11Constructor } from '@/onebot/helper/constructor';
export class GetFriendWithCategory extends BaseAction<void, any> {
actionName = ActionName.GetFriendsWithCategory;
protected async _handle(payload: void) {
async _handle(payload: void) {
if (this.CoreContext.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
//全新逻辑
return OB11Constructor.friendsV2(await this.CoreContext.getApiContext().FriendApi.getBuddyV2ExWithCate(true));

View File

@@ -10,7 +10,7 @@ interface OB11GroupRequestNotify {
export default class GetGroupAddRequest extends BaseAction<null, OB11GroupRequestNotify[] | null> {
actionName = ActionName.GetGroupIgnoreAddRequest;
protected async _handle(payload: null): Promise<OB11GroupRequestNotify[] | null> {
async _handle(payload: null): Promise<OB11GroupRequestNotify[] | null> {
const data = await this.CoreContext.getApiContext().GroupApi.getGroupIgnoreNotifies();
// log(data);
// const notifies: GroupNotify[] = data.notifies.filter(notify => notify.status === GroupNotifyStatus.WAIT_HANDLE);

View File

@@ -4,7 +4,7 @@ import { ActionName } from '../types';
export class GetProfileLike extends BaseAction<void, any> {
actionName = ActionName.GetProfileLike;
protected async _handle(payload: void) {
async _handle(payload: void) {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
const ret = await NTQQUserApi.getProfileLike(this.CoreContext.selfInfo.uid);
const listdata: any[] = ret.info.userLikeInfos[0].favoriteInfo.userInfos;

View File

@@ -4,7 +4,7 @@ import { ActionName } from '../types';
export class GetRobotUinRange extends BaseAction<void, Array<any>> {
actionName = ActionName.GetRobotUinRange;
protected async _handle(payload: void) {
async _handle(payload: void) {
// console.log(await NTQQUserApi.getRobotUinRange());
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
return await NTQQUserApi.getRobotUinRange();

View File

@@ -18,7 +18,7 @@ export class OCRImage extends BaseAction<Payload, any> {
actionName = ActionName.OCRImage;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi;
const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.image));
if (!success) {

View File

@@ -26,7 +26,7 @@ export default class SetGroupHeader extends BaseAction<Payload, any> {
};
}
protected async _handle(payload: Payload): Promise<any> {
async _handle(payload: Payload): Promise<any> {
const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi;
const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.file));
if (!success) {

View File

@@ -16,7 +16,7 @@ export class SetLongNick extends BaseAction<Payload, any> {
actionName = ActionName.SetLongNick;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
const ret = await NTQQUserApi.setLongNick(payload.longNick);
return ret;

View File

@@ -19,7 +19,7 @@ export class SetOnlineStatus extends BaseAction<Payload, null> {
actionName = ActionName.SetOnlineStatus;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
// 可设置状态
// { status: 10, extStatus: 1027, batteryStatus: 0 }
// { status: 30, extStatus: 0, batteryStatus: 0 }

View File

@@ -23,7 +23,7 @@ export default class SetAvatar extends BaseAction<Payload, null> {
};
}
protected async _handle(payload: Payload): Promise<null> {
async _handle(payload: Payload): Promise<null> {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.file));
if (!success) {

View File

@@ -18,7 +18,7 @@ export class SetSelfProfile extends BaseAction<Payload, any | null> {
actionName = ActionName.SetSelfProfile;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
const ret = await NTQQUserApi.modifySelfProfile({
nick: payload.nick,

View File

@@ -14,11 +14,11 @@ const SchemaData = {
type Payload = FromSchema<typeof SchemaData>;
export class sharePeer extends BaseAction<Payload, any> {
export class SharePeer extends BaseAction<Payload, any> {
actionName = ActionName.SharePeer;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
const NTQQUserApi = this.CoreContext.getApiContext().UserApi;
const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi;
if (payload.group_id) {
@@ -39,11 +39,11 @@ const SchemaDataGroupEx = {
type PayloadGroupEx = FromSchema<typeof SchemaDataGroupEx>;
export class shareGroupEx extends BaseAction<PayloadGroupEx, any> {
export class ShareGroupEx extends BaseAction<PayloadGroupEx, any> {
actionName = ActionName.ShareGroupEx;
PayloadSchema = SchemaDataGroupEx;
protected async _handle(payload: PayloadGroupEx) {
async _handle(payload: PayloadGroupEx) {
const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi;
return await NTQQGroupApi.getArkJsonGroupShare(payload.group_id);
}

View File

@@ -19,7 +19,7 @@ export class TranslateEnWordToZn extends BaseAction<Payload, Array<any> | null>
actionName = ActionName.TranslateEnWordToZn;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
async _handle(payload: Payload) {
const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi;
const ret = await NTQQSystemApi.translateEnWordToZn(payload.words);
if (ret.result !== 0) {