chore: actionMap

This commit is contained in:
手瓜一十雪
2024-08-09 16:28:38 +08:00
parent ff29b62398
commit 1d3ac0c9b3
2 changed files with 88 additions and 100 deletions

View File

@@ -1,7 +1,5 @@
import BaseAction from '../BaseAction'; import BaseAction from '../BaseAction';
import { getGroupMember } from '@/core/data';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { NTQQGroupApi } from '@/core/apis/group';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
const SchemaData = { const SchemaData = {

View File

@@ -24,7 +24,6 @@ import SendLike from './user/SendLike';
import SetGroupAddRequest from './group/SetGroupAddRequest'; import SetGroupAddRequest from './group/SetGroupAddRequest';
import SetGroupLeave from './group/SetGroupLeave'; import SetGroupLeave from './group/SetGroupLeave';
import GetGuildList from './group/GetGuildList'; import GetGuildList from './group/GetGuildList';
import Debug from '@/onebot11/action/extends/Debug';
import SetFriendAddRequest from './user/SetFriendAddRequest'; import SetFriendAddRequest from './user/SetFriendAddRequest';
import SetGroupWholeBan from './group/SetGroupWholeBan'; import SetGroupWholeBan from './group/SetGroupWholeBan';
import SetGroupName from './group/SetGroupName'; import SetGroupName from './group/SetGroupName';
@@ -35,26 +34,23 @@ import SetGroupCard from './group/SetGroupCard';
import GetImage from './file/GetImage'; import GetImage from './file/GetImage';
import GetRecord from './file/GetRecord'; import GetRecord from './file/GetRecord';
import { GoCQHTTPMarkMsgAsRead, MarkAllMsgAsRead, MarkGroupMsgAsRead, MarkPrivateMsgAsRead } from './msg/MarkMsgAsRead'; import { GoCQHTTPMarkMsgAsRead, MarkAllMsgAsRead, MarkGroupMsgAsRead, MarkPrivateMsgAsRead } from './msg/MarkMsgAsRead';
import CleanCache from './system/CleanCache';
import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile'; import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile';
import { GetConfigAction, SetConfigAction } from '@/onebot11/action/extends/Config'; import GetGroupAddRequest from '@/onebot/action/extends/GetGroupAddRequest';
import GetGroupAddRequest from '@/onebot11/action/extends/GetGroupAddRequest'; import SetQQAvatar from '@/onebot/action/extends/SetQQAvatar';
import SetQQAvatar from '@/onebot11/action/extends/SetQQAvatar';
import GoCQHTTPDownloadFile from './go-cqhttp/DownloadFile'; import GoCQHTTPDownloadFile from './go-cqhttp/DownloadFile';
import GoCQHTTPGetGroupMsgHistory from './go-cqhttp/GetGroupMsgHistory'; import GoCQHTTPGetGroupMsgHistory from './go-cqhttp/GetGroupMsgHistory';
import GetFile from './file/GetFile'; import GetFile from './file/GetFile';
import { GoCQHTTPGetForwardMsgAction } from './go-cqhttp/GetForwardMsg'; import { GoCQHTTPGetForwardMsgAction } from './go-cqhttp/GetForwardMsg';
import GetFriendMsgHistory from './go-cqhttp/GetFriendMsgHistory'; import GetFriendMsgHistory from './go-cqhttp/GetFriendMsgHistory';
import { GetCookies } from './user/GetCookies'; import { GetCookies } from './user/GetCookies';
import { SetMsgEmojiLike } from '@/onebot11/action/msg/SetMsgEmojiLike'; import { SetMsgEmojiLike } from '@/onebot/action/msg/SetMsgEmojiLike';
import { GetRobotUinRange } from './extends/GetRobotUinRange'; import { GetRobotUinRange } from './extends/GetRobotUinRange';
import { SetOnlineStatus } from './extends/SetOnlineStatus'; import { SetOnlineStatus } from './extends/SetOnlineStatus';
import { GetGroupNotice } from './group/GetGroupNotice'; import { GetGroupNotice } from './group/GetGroupNotice';
import { GetGroupEssence } from './group/GetGroupEssence'; import { GetGroupEssence } from './group/GetGroupEssence';
import { ForwardFriendSingleMsg, ForwardGroupSingleMsg } from '@/onebot11/action/msg/ForwardSingleMsg'; import { ForwardFriendSingleMsg, ForwardGroupSingleMsg } from '@/onebot/action/msg/ForwardSingleMsg';
import { GetFriendWithCategory } from './extends/GetFriendWithCategory'; import { GetFriendWithCategory } from './extends/GetFriendWithCategory';
import { SendGroupNotice } from './go-cqhttp/SendGroupNotice'; import { SendGroupNotice } from './go-cqhttp/SendGroupNotice';
import { Reboot, RebootNormal } from './system/Reboot';
import { GetGroupHonorInfo } from './go-cqhttp/GetGroupHonorInfo'; import { GetGroupHonorInfo } from './go-cqhttp/GetGroupHonorInfo';
import { GoCQHTTPHandleQuickAction } from './go-cqhttp/QuickAction'; import { GoCQHTTPHandleQuickAction } from './go-cqhttp/QuickAction';
import { GetGroupSystemMsg } from './group/GetGroupSystemMsg'; import { GetGroupSystemMsg } from './group/GetGroupSystemMsg';
@@ -77,96 +73,92 @@ import { GetProfileLike } from './extends/GetProfileLike';
import SetGroupHeader from './extends/SetGroupHeader'; import SetGroupHeader from './extends/SetGroupHeader';
import { FetchCustomFace } from './extends/FetchCustomFace'; import { FetchCustomFace } from './extends/FetchCustomFace';
import GoCQHTTPUploadPrivateFile from './go-cqhttp/UploadPrivareFile'; import GoCQHTTPUploadPrivateFile from './go-cqhttp/UploadPrivareFile';
import TestApi01 from './extends/TestApi01';
import { FetchEmojioLike } from './extends/FetchEmojioLike'; import { FetchEmojioLike } from './extends/FetchEmojioLike';
import { NapCatCore } from '@/core';
export const actionHandlers = [ export function createActionMap(context: NapCatCore) {
new FetchEmojioLike(), let actionHandlers = [
new RebootNormal(), new FetchEmojioLike(context),
new GetFile(), new GetFile(context),
new Debug(), new SetSelfProfile(context),
new Reboot(), new shareGroupEx(context),
new SetSelfProfile(), new sharePeer(context),
new shareGroupEx(), new CreateCollection(context),
new sharePeer(), new SetLongNick(context),
new CreateCollection(), new ForwardFriendSingleMsg(context),
new SetLongNick(), new ForwardGroupSingleMsg(context),
new ForwardFriendSingleMsg(), new MarkGroupMsgAsRead(context),
new ForwardGroupSingleMsg(), new MarkPrivateMsgAsRead(context),
new MarkGroupMsgAsRead(), new SetQQAvatar(context),
new MarkPrivateMsgAsRead(), new TranslateEnWordToZn(context),
new SetQQAvatar(), new GetGroupFileCount(context),
new TranslateEnWordToZn(), new GetGroupFileList(context),
new GetGroupFileCount(), new SetGroupFileFolder(context),
new GetGroupFileList(), new DelGroupFile(context),
new SetGroupFileFolder(), new DelGroupFileFolder(context),
new DelGroupFile(), // onebot11
new DelGroupFileFolder(), new SendLike(context),
// onebot11 new GetMsg(context),
new SendLike(), new GetLoginInfo(context),
new GetMsg(), new GetFriendList(context),
new GetLoginInfo(), new GetGroupList(context),
new GetFriendList(), new GetGroupInfo(context),
new GetGroupList(), new GetGroupMemberList(context),
new GetGroupInfo(), new GetGroupMemberInfo(context),
new GetGroupMemberList(), new SendGroupMsg(context),
new GetGroupMemberInfo(), new SendPrivateMsg(context),
new SendGroupMsg(), new SendMsg(context),
new SendPrivateMsg(), new DeleteMsg(context),
new SendMsg(), new SetGroupAddRequest(context),
new DeleteMsg(), new SetFriendAddRequest(context),
new SetGroupAddRequest(), new SetGroupLeave(context),
new SetFriendAddRequest(), new GetVersionInfo(context),
new SetGroupLeave(), new CanSendRecord(context),
new GetVersionInfo(), new CanSendImage(context),
new CanSendRecord(), new GetStatus(context),
new CanSendImage(), new SetGroupWholeBan(context),
new GetStatus(), new SetGroupBan(context),
new SetGroupWholeBan(), new SetGroupKick(context),
new SetGroupBan(), new SetGroupAdmin(context),
new SetGroupKick(), new SetGroupName(context),
new SetGroupAdmin(), new SetGroupCard(context),
new SetGroupName(), new GetImage(context),
new SetGroupCard(), new GetRecord(context),
new GetImage(), new SetMsgEmojiLike(context),
new GetRecord(), new GetCookies(context),
new SetMsgEmojiLike(), new SetOnlineStatus(context),
new GetCookies(), new GetRobotUinRange(context),
new SetOnlineStatus(), new GetFriendWithCategory(context),
new GetRobotUinRange(), //以下为go-cqhttp api
new GetFriendWithCategory(), new GetOnlineClient(context),
//以下为go-cqhttp api new OCRImage(context),
new GetOnlineClient(), new IOCRImage(context),
new OCRImage(), new GetGroupHonorInfo(context),
new IOCRImage(), new SendGroupNotice(context),
new GetGroupHonorInfo(), new GetGroupNotice(context),
new SendGroupNotice(), new GetGroupEssence(context),
new GetGroupNotice(), new GoCQHTTPSendForwardMsg(context),
new GetGroupEssence(), new GoCQHTTPSendGroupForwardMsg(context),
new GoCQHTTPSendForwardMsg(), new GoCQHTTPSendPrivateForwardMsg(context),
new GoCQHTTPSendGroupForwardMsg(), new GoCQHTTPGetStrangerInfo(context),
new GoCQHTTPSendPrivateForwardMsg(), new GoCQHTTPDownloadFile(context),
new GoCQHTTPGetStrangerInfo(), new GetGuildList(context),
new GoCQHTTPDownloadFile(), new GoCQHTTPMarkMsgAsRead(context),
new GetGuildList(), new GoCQHTTPUploadGroupFile(context),
new GoCQHTTPMarkMsgAsRead(), new GoCQHTTPGetGroupMsgHistory(context),
new GoCQHTTPUploadGroupFile(), new GoCQHTTPGetForwardMsgAction(context),
new GoCQHTTPGetGroupMsgHistory(), new GetFriendMsgHistory(context),
new GoCQHTTPGetForwardMsgAction(), new GoCQHTTPHandleQuickAction(context),
new GetFriendMsgHistory(), new GetGroupSystemMsg(context),
new GoCQHTTPHandleQuickAction(), new DelEssenceMsg(context),
new GetGroupSystemMsg(), new SetEssenceMsg(context),
new DelEssenceMsg(), new GetRecentContact(context),
new SetEssenceMsg(), new MarkAllMsgAsRead(context),
new GetRecentContact(), new GetProfileLike(context),
new MarkAllMsgAsRead(), new SetGroupHeader(context),
new GetProfileLike(), new FetchCustomFace(context),
new SetGroupHeader(), new GoCQHTTPUploadPrivateFile(context)
new FetchCustomFace(), ];
new GoCQHTTPUploadPrivateFile(),
new TestApi01()
];
function initActionMap() {
const actionMap = new Map<string, BaseAction<any, any>>(); const actionMap = new Map<string, BaseAction<any, any>>();
for (const action of actionHandlers) { for (const action of actionHandlers) {
actionMap.set(action.actionName, action); actionMap.set(action.actionName, action);
@@ -176,5 +168,3 @@ function initActionMap() {
return actionMap; return actionMap;
} }
export const actionMap = initActionMap();