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(),
new DelGroupFileFolder(),
// onebot11 // onebot11
new SendLike(), new SendLike(context),
new GetMsg(), new GetMsg(context),
new GetLoginInfo(), new GetLoginInfo(context),
new GetFriendList(), new GetFriendList(context),
new GetGroupList(), new GetGroupList(context),
new GetGroupInfo(), new GetGroupInfo(context),
new GetGroupMemberList(), new GetGroupMemberList(context),
new GetGroupMemberInfo(), new GetGroupMemberInfo(context),
new SendGroupMsg(), new SendGroupMsg(context),
new SendPrivateMsg(), new SendPrivateMsg(context),
new SendMsg(), new SendMsg(context),
new DeleteMsg(), new DeleteMsg(context),
new SetGroupAddRequest(), new SetGroupAddRequest(context),
new SetFriendAddRequest(), new SetFriendAddRequest(context),
new SetGroupLeave(), new SetGroupLeave(context),
new GetVersionInfo(), new GetVersionInfo(context),
new CanSendRecord(), new CanSendRecord(context),
new CanSendImage(), new CanSendImage(context),
new GetStatus(), new GetStatus(context),
new SetGroupWholeBan(), new SetGroupWholeBan(context),
new SetGroupBan(), new SetGroupBan(context),
new SetGroupKick(), new SetGroupKick(context),
new SetGroupAdmin(), new SetGroupAdmin(context),
new SetGroupName(), new SetGroupName(context),
new SetGroupCard(), new SetGroupCard(context),
new GetImage(), new GetImage(context),
new GetRecord(), new GetRecord(context),
new SetMsgEmojiLike(), new SetMsgEmojiLike(context),
new GetCookies(), new GetCookies(context),
new SetOnlineStatus(), new SetOnlineStatus(context),
new GetRobotUinRange(), new GetRobotUinRange(context),
new GetFriendWithCategory(), new GetFriendWithCategory(context),
//以下为go-cqhttp api //以下为go-cqhttp api
new GetOnlineClient(), new GetOnlineClient(context),
new OCRImage(), new OCRImage(context),
new IOCRImage(), new IOCRImage(context),
new GetGroupHonorInfo(), new GetGroupHonorInfo(context),
new SendGroupNotice(), new SendGroupNotice(context),
new GetGroupNotice(), new GetGroupNotice(context),
new GetGroupEssence(), new GetGroupEssence(context),
new GoCQHTTPSendForwardMsg(), new GoCQHTTPSendForwardMsg(context),
new GoCQHTTPSendGroupForwardMsg(), new GoCQHTTPSendGroupForwardMsg(context),
new GoCQHTTPSendPrivateForwardMsg(), new GoCQHTTPSendPrivateForwardMsg(context),
new GoCQHTTPGetStrangerInfo(), new GoCQHTTPGetStrangerInfo(context),
new GoCQHTTPDownloadFile(), new GoCQHTTPDownloadFile(context),
new GetGuildList(), new GetGuildList(context),
new GoCQHTTPMarkMsgAsRead(), new GoCQHTTPMarkMsgAsRead(context),
new GoCQHTTPUploadGroupFile(), new GoCQHTTPUploadGroupFile(context),
new GoCQHTTPGetGroupMsgHistory(), new GoCQHTTPGetGroupMsgHistory(context),
new GoCQHTTPGetForwardMsgAction(), new GoCQHTTPGetForwardMsgAction(context),
new GetFriendMsgHistory(), new GetFriendMsgHistory(context),
new GoCQHTTPHandleQuickAction(), new GoCQHTTPHandleQuickAction(context),
new GetGroupSystemMsg(), new GetGroupSystemMsg(context),
new DelEssenceMsg(), new DelEssenceMsg(context),
new SetEssenceMsg(), new SetEssenceMsg(context),
new GetRecentContact(), new GetRecentContact(context),
new MarkAllMsgAsRead(), new MarkAllMsgAsRead(context),
new GetProfileLike(), new GetProfileLike(context),
new SetGroupHeader(), new SetGroupHeader(context),
new FetchCustomFace(), new FetchCustomFace(context),
new GoCQHTTPUploadPrivateFile(), new GoCQHTTPUploadPrivateFile(context)
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();