diff --git a/src/onebot11/action/group/GetGroupEssence.ts b/src/onebot11/action/group/GetGroupEssence.ts new file mode 100644 index 0000000..739eee5 --- /dev/null +++ b/src/onebot11/action/group/GetGroupEssence.ts @@ -0,0 +1,20 @@ +import { GroupEssenceMsgRet, WebApi } from "@/ntqqapi/api"; +import BaseAction from "../BaseAction"; +import { ActionName } from "../types"; + +interface PayloadType { + group_id: number; + pages: number; +} + +export class GetGroupEssence extends BaseAction { + actionName = ActionName.GoCQHTTP_GetEssenceMsg; + + protected async _handle(payload: PayloadType) { + const ret = await WebApi.getGroupEssenceMsg(payload.group_id.toString(), payload.pages.toString()); + if (!ret) { + throw new Error('获取失败'); + } + return ret; + } +} diff --git a/src/onebot11/action/group/GetGroupHonorInfo.ts b/src/onebot11/action/group/GetGroupHonorInfo.ts new file mode 100644 index 0000000..9e72ecd --- /dev/null +++ b/src/onebot11/action/group/GetGroupHonorInfo.ts @@ -0,0 +1,22 @@ +import { WebApi, WebHonorType } from "@/ntqqapi/api"; +import { ActionName } from "../types"; +import BaseAction from "../BaseAction"; + +interface Payload { + group_id: number, + type?: WebHonorType +} +export class GetGroupHonorInfo extends BaseAction> { + actionName = ActionName.GetGroupHonorInfo; + + protected async _handle(payload: Payload) { + // console.log(await NTQQUserApi.getRobotUinRange()); + if (!payload.group_id) { + throw '缺少参数group_id'; + } + if (!payload.type) { + payload.type = WebHonorType.ALL; + } + return await WebApi.getGroupHonorInfo(payload.group_id.toString(), payload.type); + } +} diff --git a/src/onebot11/action/index.ts b/src/onebot11/action/index.ts index a5a4539..adc8edc 100644 --- a/src/onebot11/action/index.ts +++ b/src/onebot11/action/index.ts @@ -47,6 +47,8 @@ import { GoCQHTTGetForwardMsgAction } from './go-cqhttp/GetForwardMsg' import { GetCookies } from './user/GetCookie' import { SetMsgEmojiLike } from './msg/SetMsgEmojiLike' import { ForwardFriendSingleMsg, ForwardSingleGroupMsg } from './msg/ForwardSingleMsg' +import { GetGroupEssence } from './group/GetGroupEssence' +import { GetGroupHonorInfo } from './group/GetGroupHonorInfo' export const actionHandlers = [ new GetFile(), @@ -89,6 +91,8 @@ export const actionHandlers = [ new ForwardFriendSingleMsg(), new ForwardSingleGroupMsg(), //以下为go-cqhttp api + new GetGroupEssence(), + new GetGroupHonorInfo(), new GoCQHTTPSendForwardMsg(), new GoCQHTTPSendGroupForwardMsg(), new GoCQHTTPSendPrivateForwardMsg(), diff --git a/src/onebot11/action/types.ts b/src/onebot11/action/types.ts index 039aa15..5d15705 100644 --- a/src/onebot11/action/types.ts +++ b/src/onebot11/action/types.ts @@ -66,4 +66,6 @@ export enum ActionName { GoCQHTTP_DownloadFile = 'download_file', GoCQHTTP_GetGroupMsgHistory = 'get_group_msg_history', GoCQHTTP_GetForwardMsg = 'get_forward_msg', + GoCQHTTP_GetEssenceMsg = "get_essence_msg_list", + GetGroupHonorInfo = "get_group_honor_info", }