From 5c6acbb7801464d551fe759a3365b7a136c7136a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sun, 28 Apr 2024 20:30:53 +0800 Subject: [PATCH] fix --- src/onebot11/action/group/GetGroupNotice.ts | 18 +++++++++++------- src/onebot11/action/index.ts | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/onebot11/action/group/GetGroupNotice.ts b/src/onebot11/action/group/GetGroupNotice.ts index df8d4f7f..a0410881 100644 --- a/src/onebot11/action/group/GetGroupNotice.ts +++ b/src/onebot11/action/group/GetGroupNotice.ts @@ -1,3 +1,4 @@ +import { WebApi, WebApiGroupNoticeRet } from '@/core/apis/webapi'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; @@ -5,12 +6,15 @@ interface PayloadType { group_id: number } -export class GetGroupNotice extends BaseAction { - actionName = ActionName.GoCQHTTP_GetGroupNotice; +export class GetGroupNotice extends BaseAction { + actionName = ActionName.GoCQHTTP_GetGroupNotice; - protected async _handle(payload: PayloadType) { - const group = payload.group_id.toString(); - // WebApi.getGrouptNotice(group); - return null; - } + protected async _handle(payload: PayloadType) { + const group = payload.group_id.toString(); + let ret = await WebApi.getGrouptNotice(group); + if (!ret) { + throw new Error('获取公告失败'); + } + return ret; + } } \ No newline at end of file diff --git a/src/onebot11/action/index.ts b/src/onebot11/action/index.ts index 7bcf595a..ea5c2c1c 100644 --- a/src/onebot11/action/index.ts +++ b/src/onebot11/action/index.ts @@ -49,6 +49,7 @@ import { GetCookies } from './user/GetCookies'; import { SetMsgEmojiLike } from '@/onebot11/action/msg/SetMsgEmojiLike'; import { GetRobotUinRange } from './extends/GetRobotUinRange'; import { SetOnlineStatus } from './extends/SetOnlineStatus'; +import { GetGroupNotice } from './group/GetGroupNotice'; export const actionHandlers = [ new GetFile(), @@ -90,6 +91,7 @@ export const actionHandlers = [ new SetOnlineStatus(), new GetRobotUinRange(), //以下为go-cqhttp api + new GetGroupNotice(), new GoCQHTTPSendForwardMsg(), new GoCQHTTPSendGroupForwardMsg(), new GoCQHTTPSendPrivateForwardMsg(),