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 1/5] 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(), From cb2baf747d8be71e446b794f87f6f0661ee6e66c 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:32:37 +0800 Subject: [PATCH 2/5] fix --- src/core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core b/src/core index 0252eba3..9c1da766 160000 --- a/src/core +++ b/src/core @@ -1 +1 @@ -Subproject commit 0252eba3beb5adeac068a8de069f1f82e9cf9b8d +Subproject commit 9c1da766f8901314a83669c47cf5ccc836e617ad From e6da0e5dd5768c52ac3380468f193b054978a9bf 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:36:30 +0800 Subject: [PATCH 3/5] fix --- CHANGELOG.md | 2 +- src/onebot11/action/group/SetGroupNotice.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b86ed22..9090d90e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,4 +12,4 @@ 12. 修复群成员加入时间 上次活跃 活跃等级字段 - 影响 API: /get_group_member_info /get_group_member_list 13. 修复视频所需的 ffmpeg 路径不正确导致视频封面和时长获取失败 - 影响 Event/API 14. 支持音乐卡片,需要配置签名服务器地址, `config/onebot11_.json`的`musicSignUrl`字段 - 新增 Feat: Sign Music -15. 支持获取与设置群公告 - 新增 API: /_send_group_notice /_get_group_notice +15. 支持获取与设置群公告 - 新增 API: (/_send_group_notice 暂时未完全实现) /_get_group_notice diff --git a/src/onebot11/action/group/SetGroupNotice.ts b/src/onebot11/action/group/SetGroupNotice.ts index 5a261090..88eb3fa5 100644 --- a/src/onebot11/action/group/SetGroupNotice.ts +++ b/src/onebot11/action/group/SetGroupNotice.ts @@ -1,3 +1,4 @@ +import { WebApi } from '@/core/apis/webapi'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; @@ -10,7 +11,7 @@ export class SetGroupNotice extends BaseAction { protected async _handle(payload: PayloadType) { const group = payload.group_id.toString(); - // WebApi.getGrouptNotice(group); + WebApi.setGroupNotice(group); return null; } } \ No newline at end of file From 98590e2d90296be1f680c9a6c9085cfcd9e3d660 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:36:52 +0800 Subject: [PATCH 4/5] fix --- src/core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core b/src/core index 9c1da766..aa3221a8 160000 --- a/src/core +++ b/src/core @@ -1 +1 @@ -Subproject commit 9c1da766f8901314a83669c47cf5ccc836e617ad +Subproject commit aa3221a8904bf6b66cb85325cda85cbcea5639a0 From c35fd4bdc89571a276ee140426f9cb68fca7ca66 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:38:44 +0800 Subject: [PATCH 5/5] build:test --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9090d90e..b1dde896 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,3 +13,4 @@ 13. 修复视频所需的 ffmpeg 路径不正确导致视频封面和时长获取失败 - 影响 Event/API 14. 支持音乐卡片,需要配置签名服务器地址, `config/onebot11_.json`的`musicSignUrl`字段 - 新增 Feat: Sign Music 15. 支持获取与设置群公告 - 新增 API: (/_send_group_notice 暂时未完全实现) /_get_group_notice +