mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
refactor
This commit is contained in:
@@ -7,7 +7,7 @@ interface Payload {
|
||||
parent_id?: '/'
|
||||
}
|
||||
|
||||
export class GoCQHTTPCreateGroupFileFolder extends BaseAction<Payload, null> {
|
||||
export class CreateGroupFileFolder extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_CreateGroupFileFolder
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
|
@@ -6,7 +6,7 @@ interface Payload {
|
||||
message_id: number | string
|
||||
}
|
||||
|
||||
export default class GoCQHTTPDelEssenceMsg extends BaseAction<Payload, any> {
|
||||
export class DelEssenceMsg extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_DelEssenceMsg;
|
||||
|
||||
protected async _handle(payload: Payload): Promise<any> {
|
||||
|
@@ -7,7 +7,7 @@ interface Payload {
|
||||
busid?: 102
|
||||
}
|
||||
|
||||
export class GoCQHTTPDelGroupFile extends BaseAction<Payload, null> {
|
||||
export class DelGroupFile extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_DelGroupFile
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
|
@@ -6,7 +6,7 @@ interface Payload {
|
||||
folder_id: string
|
||||
}
|
||||
|
||||
export class GoCQHTTPDelGroupFolder extends BaseAction<Payload, null> {
|
||||
export class DelGroupFolder extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_DelGroupFolder
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
|
@@ -19,7 +19,7 @@ interface FileResponse {
|
||||
file: string
|
||||
}
|
||||
|
||||
export default class GoCQHTTPDownloadFile extends BaseAction<Payload, FileResponse> {
|
||||
export class DownloadFile extends BaseAction<Payload, FileResponse> {
|
||||
actionName = ActionName.GoCQHTTP_DownloadFile
|
||||
|
||||
protected async _handle(payload: Payload): Promise<FileResponse> {
|
||||
|
@@ -13,7 +13,7 @@ interface Response {
|
||||
messages: (OB11Message & { content: OB11MessageData })[]
|
||||
}
|
||||
|
||||
export class GoCQHTTGetForwardMsgAction extends BaseAction<Payload, Response> {
|
||||
export class GetForwardMsg extends BaseAction<Payload, Response> {
|
||||
actionName = ActionName.GoCQHTTP_GetForwardMsg
|
||||
protected async _handle(payload: Payload): Promise<any> {
|
||||
const msgId = payload.id || payload.message_id
|
||||
|
@@ -17,7 +17,7 @@ interface Response {
|
||||
messages: OB11Message[]
|
||||
}
|
||||
|
||||
export default class GoCQHTTPGetGroupMsgHistory extends BaseAction<Payload, Response> {
|
||||
export class GetGroupMsgHistory extends BaseAction<Payload, Response> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupMsgHistory
|
||||
|
||||
protected async _handle(payload: Payload): Promise<Response> {
|
||||
|
@@ -24,7 +24,7 @@ interface Response {
|
||||
}[]
|
||||
}
|
||||
|
||||
export class GoCQHTTPGetGroupSystemMsg extends BaseAction<void, Response> {
|
||||
export class GetGroupSystemMsg extends BaseAction<void, Response> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupSystemMsg
|
||||
|
||||
async _handle(payload: void) {
|
||||
|
@@ -10,7 +10,7 @@ interface Payload {
|
||||
user_id: number | string
|
||||
}
|
||||
|
||||
export default class GoCQHTTPGetStrangerInfo extends BaseAction<Payload, OB11User> {
|
||||
export class GetStrangerInfo extends BaseAction<Payload, OB11User> {
|
||||
actionName = ActionName.GoCQHTTP_GetStrangerInfo
|
||||
|
||||
protected async _handle(payload: Payload): Promise<OB11User> {
|
||||
|
@@ -5,7 +5,7 @@ interface Payload {
|
||||
message_id: number
|
||||
}
|
||||
|
||||
export default class GoCQHTTPMarkMsgAsRead extends BaseAction<Payload, null> {
|
||||
export class MarkMsgAsRead extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_MarkMsgAsRead
|
||||
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
@@ -7,7 +7,7 @@ interface Payload {
|
||||
operation: QuickOperation
|
||||
}
|
||||
|
||||
export class GoCQHTTHandleQuickOperation extends BaseAction<Payload, null> {
|
||||
export class HandleQuickOperation extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_HandleQuickOperation
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
||||
handleQuickOperation(this.ctx, payload.context, payload.operation).catch(e => this.ctx.logger.error(e))
|
||||
|
@@ -3,7 +3,7 @@ import { OB11PostSendMsg } from '../../types'
|
||||
import { ActionName } from '../types'
|
||||
import { convertMessage2List } from '../../helper/createMessage'
|
||||
|
||||
export class GoCQHTTPSendForwardMsg extends SendMsg {
|
||||
export class SendForwardMsg extends SendMsg {
|
||||
actionName = ActionName.GoCQHTTP_SendForwardMsg
|
||||
|
||||
protected async check(payload: OB11PostSendMsg) {
|
||||
@@ -12,10 +12,10 @@ export class GoCQHTTPSendForwardMsg extends SendMsg {
|
||||
}
|
||||
}
|
||||
|
||||
export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsg {
|
||||
export class SendPrivateForwardMsg extends SendForwardMsg {
|
||||
actionName = ActionName.GoCQHTTP_SendPrivateForwardMsg
|
||||
}
|
||||
|
||||
export class GoCQHTTPSendGroupForwardMsg extends GoCQHTTPSendForwardMsg {
|
||||
export class SendGroupForwardMsg extends SendForwardMsg {
|
||||
actionName = ActionName.GoCQHTTP_SendGroupForwardMsg
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ interface Payload {
|
||||
message_id: number | string
|
||||
}
|
||||
|
||||
export default class GoCQHTTPSetEssenceMsg extends BaseAction<Payload, any> {
|
||||
export class SetEssenceMsg extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_SetEssenceMsg;
|
||||
|
||||
protected async _handle(payload: Payload): Promise<any> {
|
||||
|
@@ -16,7 +16,7 @@ interface Payload {
|
||||
folder_id?: string
|
||||
}
|
||||
|
||||
export class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
|
||||
export class UploadGroupFile extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_UploadGroupFile
|
||||
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
||||
@@ -37,7 +37,7 @@ export class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
|
||||
}
|
||||
}
|
||||
|
||||
export class GoCQHTTPUploadPrivateFile extends BaseAction<Payload, null> {
|
||||
export class UploadPrivateFile extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.GoCQHTTP_UploadPrivateFile
|
||||
|
||||
async getPeer(payload: Payload): Promise<Peer> {
|
||||
|
@@ -16,11 +16,11 @@ import CanSendRecord from './system/CanSendRecord'
|
||||
import CanSendImage from './system/CanSendImage'
|
||||
import GetStatus from './system/GetStatus'
|
||||
import {
|
||||
GoCQHTTPSendForwardMsg,
|
||||
GoCQHTTPSendGroupForwardMsg,
|
||||
GoCQHTTPSendPrivateForwardMsg,
|
||||
SendForwardMsg,
|
||||
SendGroupForwardMsg,
|
||||
SendPrivateForwardMsg,
|
||||
} from './go-cqhttp/SendForwardMsg'
|
||||
import GoCQHTTPGetStrangerInfo from './go-cqhttp/GetStrangerInfo'
|
||||
import { GetStrangerInfo } from './go-cqhttp/GetStrangerInfo'
|
||||
import SendLike from './user/SendLike'
|
||||
import SetGroupAddRequest from './group/SetGroupAddRequest'
|
||||
import SetGroupLeave from './group/SetGroupLeave'
|
||||
@@ -35,29 +35,30 @@ import SetGroupAdmin from './group/SetGroupAdmin'
|
||||
import SetGroupCard from './group/SetGroupCard'
|
||||
import GetImage from './file/GetImage'
|
||||
import GetRecord from './file/GetRecord'
|
||||
import GoCQHTTPMarkMsgAsRead from './msg/MarkMsgAsRead'
|
||||
import { MarkMsgAsRead } from './go-cqhttp/MarkMsgAsRead'
|
||||
import CleanCache from './system/CleanCache'
|
||||
import { GoCQHTTPUploadGroupFile, GoCQHTTPUploadPrivateFile } from './go-cqhttp/UploadFile'
|
||||
import { UploadGroupFile, UploadPrivateFile } from './go-cqhttp/UploadFile'
|
||||
import { GetConfigAction, SetConfigAction } from './llonebot/Config'
|
||||
import GetGroupAddRequest from './llonebot/GetGroupAddRequest'
|
||||
import SetQQAvatar from './llonebot/SetQQAvatar'
|
||||
import GoCQHTTPDownloadFile from './go-cqhttp/DownloadFile'
|
||||
import GoCQHTTPGetGroupMsgHistory from './go-cqhttp/GetGroupMsgHistory'
|
||||
import { DownloadFile } from './go-cqhttp/DownloadFile'
|
||||
import { GetGroupMsgHistory } from './go-cqhttp/GetGroupMsgHistory'
|
||||
import GetFile from './file/GetFile'
|
||||
import { GoCQHTTGetForwardMsgAction } from './go-cqhttp/GetForwardMsg'
|
||||
import { GetForwardMsg } from './go-cqhttp/GetForwardMsg'
|
||||
import { GetCookies } from './user/GetCookie'
|
||||
import { SetMsgEmojiLike } from './msg/SetMsgEmojiLike'
|
||||
import { ForwardFriendSingleMsg, ForwardGroupSingleMsg } from './msg/ForwardSingleMsg'
|
||||
import { GetGroupEssence } from './group/GetGroupEssence'
|
||||
import { GetGroupHonorInfo } from './group/GetGroupHonorInfo'
|
||||
import { GoCQHTTHandleQuickOperation } from './go-cqhttp/QuickOperation'
|
||||
import GoCQHTTPSetEssenceMsg from './go-cqhttp/SetEssenceMsg'
|
||||
import GoCQHTTPDelEssenceMsg from './go-cqhttp/DelEssenceMsg'
|
||||
import { HandleQuickOperation } from './go-cqhttp/QuickOperation'
|
||||
import { SetEssenceMsg } from './go-cqhttp/SetEssenceMsg'
|
||||
import { DelEssenceMsg } from './go-cqhttp/DelEssenceMsg'
|
||||
import GetEvent from './llonebot/GetEvent'
|
||||
import { GoCQHTTPDelGroupFile } from './go-cqhttp/DelGroupFile'
|
||||
import { GoCQHTTPGetGroupSystemMsg } from './go-cqhttp/GetGroupSystemMsg'
|
||||
import { GoCQHTTPCreateGroupFileFolder } from './go-cqhttp/CreateGroupFileFolder'
|
||||
import { GoCQHTTPDelGroupFolder } from './go-cqhttp/DelGroupFolder'
|
||||
import { DelGroupFile } from './go-cqhttp/DelGroupFile'
|
||||
import { GetGroupSystemMsg } from './go-cqhttp/GetGroupSystemMsg'
|
||||
import { CreateGroupFileFolder } from './go-cqhttp/CreateGroupFileFolder'
|
||||
import { DelGroupFolder } from './go-cqhttp/DelGroupFolder'
|
||||
import { GetGroupAtAllRemain } from './go-cqhttp/GetGroupAtAllRemain'
|
||||
|
||||
export function initActionMap(adapter: Adapter) {
|
||||
const actionHandlers = [
|
||||
@@ -105,24 +106,25 @@ export function initActionMap(adapter: Adapter) {
|
||||
//以下为go-cqhttp api
|
||||
new GetGroupEssence(adapter),
|
||||
new GetGroupHonorInfo(adapter),
|
||||
new GoCQHTTPSendForwardMsg(adapter),
|
||||
new GoCQHTTPSendGroupForwardMsg(adapter),
|
||||
new GoCQHTTPSendPrivateForwardMsg(adapter),
|
||||
new GoCQHTTPGetStrangerInfo(adapter),
|
||||
new GoCQHTTPDownloadFile(adapter),
|
||||
new SendForwardMsg(adapter),
|
||||
new SendGroupForwardMsg(adapter),
|
||||
new SendPrivateForwardMsg(adapter),
|
||||
new GetStrangerInfo(adapter),
|
||||
new DownloadFile(adapter),
|
||||
new GetGuildList(adapter),
|
||||
new GoCQHTTPMarkMsgAsRead(adapter),
|
||||
new GoCQHTTPUploadGroupFile(adapter),
|
||||
new GoCQHTTPUploadPrivateFile(adapter),
|
||||
new GoCQHTTPGetGroupMsgHistory(adapter),
|
||||
new GoCQHTTGetForwardMsgAction(adapter),
|
||||
new GoCQHTTHandleQuickOperation(adapter),
|
||||
new GoCQHTTPSetEssenceMsg(adapter),
|
||||
new GoCQHTTPDelEssenceMsg(adapter),
|
||||
new GoCQHTTPDelGroupFile(adapter),
|
||||
new GoCQHTTPGetGroupSystemMsg(adapter),
|
||||
new GoCQHTTPCreateGroupFileFolder(adapter),
|
||||
new GoCQHTTPDelGroupFolder(adapter)
|
||||
new MarkMsgAsRead(adapter),
|
||||
new UploadGroupFile(adapter),
|
||||
new UploadPrivateFile(adapter),
|
||||
new GetGroupMsgHistory(adapter),
|
||||
new GetForwardMsg(adapter),
|
||||
new HandleQuickOperation(adapter),
|
||||
new SetEssenceMsg(adapter),
|
||||
new DelEssenceMsg(adapter),
|
||||
new DelGroupFile(adapter),
|
||||
new GetGroupSystemMsg(adapter),
|
||||
new CreateGroupFileFolder(adapter),
|
||||
new DelGroupFolder(adapter),
|
||||
new GetGroupAtAllRemain(adapter)
|
||||
]
|
||||
const actionMap = new Map<string, BaseAction<any, any>>()
|
||||
for (const action of actionHandlers) {
|
||||
|
Reference in New Issue
Block a user