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