feat: new Api GetGroupEssence&GetGroupHonorInfo

This commit is contained in:
手瓜一十雪 2024-05-15 21:12:10 +08:00
parent 6e5cfd827c
commit 9672f67a23
4 changed files with 48 additions and 0 deletions

View File

@ -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<PayloadType, GroupEssenceMsgRet> {
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;
}
}

View File

@ -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<Payload, Array<any>> {
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);
}
}

View File

@ -47,6 +47,8 @@ import { GoCQHTTGetForwardMsgAction } 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, ForwardSingleGroupMsg } from './msg/ForwardSingleMsg' import { ForwardFriendSingleMsg, ForwardSingleGroupMsg } from './msg/ForwardSingleMsg'
import { GetGroupEssence } from './group/GetGroupEssence'
import { GetGroupHonorInfo } from './group/GetGroupHonorInfo'
export const actionHandlers = [ export const actionHandlers = [
new GetFile(), new GetFile(),
@ -89,6 +91,8 @@ export const actionHandlers = [
new ForwardFriendSingleMsg(), new ForwardFriendSingleMsg(),
new ForwardSingleGroupMsg(), new ForwardSingleGroupMsg(),
//以下为go-cqhttp api //以下为go-cqhttp api
new GetGroupEssence(),
new GetGroupHonorInfo(),
new GoCQHTTPSendForwardMsg(), new GoCQHTTPSendForwardMsg(),
new GoCQHTTPSendGroupForwardMsg(), new GoCQHTTPSendGroupForwardMsg(),
new GoCQHTTPSendPrivateForwardMsg(), new GoCQHTTPSendPrivateForwardMsg(),

View File

@ -66,4 +66,6 @@ export enum ActionName {
GoCQHTTP_DownloadFile = 'download_file', GoCQHTTP_DownloadFile = 'download_file',
GoCQHTTP_GetGroupMsgHistory = 'get_group_msg_history', GoCQHTTP_GetGroupMsgHistory = 'get_group_msg_history',
GoCQHTTP_GetForwardMsg = 'get_forward_msg', GoCQHTTP_GetForwardMsg = 'get_forward_msg',
GoCQHTTP_GetEssenceMsg = "get_essence_msg_list",
GetGroupHonorInfo = "get_group_honor_info",
} }