Skip to content

Commit ccc03e3

Browse files
authored
feat(api): add more parameters (#109)
1 parent 6197b8e commit ccc03e3

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

api.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -542,33 +542,38 @@ func (ctx *Ctx) GetThisGroupAtAllRemain() gjson.Result {
542542

543543
// GetGroupMessageHistory 获取群消息历史记录
544544
// https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%B6%88%E6%81%AF%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95
545+
// https://napcat.apifox.cn/226657401e0
545546
//
546-
// messageID: 起始消息序号, 可通过 get_msg 获得
547-
func (ctx *Ctx) GetGroupMessageHistory(groupID, messageID int64) gjson.Result {
547+
// messageID: 起始消息序号, 可通过 get_msg 获得, 添加count和reverseOrder参数
548+
func (ctx *Ctx) GetGroupMessageHistory(groupID, messageID, count int64, reverseOrder bool) gjson.Result {
548549
return ctx.CallAction("get_group_msg_history", Params{
549-
"group_id": groupID,
550-
"message_seq": messageID, // 兼容旧版本
551-
"message_id": messageID,
550+
"group_id": groupID,
551+
"message_seq": messageID, // 兼容旧版本
552+
"message_id": messageID,
553+
"count": count, // 兼容napcat
554+
"reverseOrder": reverseOrder, // 兼容napcat
552555
}).Data
553556
}
554557

555558
// GettLatestGroupMessageHistory 获取最新群消息历史记录
556-
func (ctx *Ctx) GetLatestGroupMessageHistory(groupID int64) gjson.Result {
559+
func (ctx *Ctx) GetLatestGroupMessageHistory(groupID, count int64, reverseOrder bool) gjson.Result {
557560
return ctx.CallAction("get_group_msg_history", Params{
558-
"group_id": groupID,
561+
"group_id": groupID,
562+
"count": count, // 兼容napcat
563+
"reverseOrder": reverseOrder, // 兼容napcat
559564
}).Data
560565
}
561566

562567
// GetThisGroupMessageHistory 获取本群消息历史记录
563568
//
564569
// messageID: 起始消息序号, 可通过 get_msg 获得
565-
func (ctx *Ctx) GetThisGroupMessageHistory(messageID int64) gjson.Result {
566-
return ctx.GetGroupMessageHistory(ctx.Event.GroupID, messageID)
570+
func (ctx *Ctx) GetThisGroupMessageHistory(messageID, count int64, reverseOrder bool) gjson.Result {
571+
return ctx.GetGroupMessageHistory(ctx.Event.GroupID, messageID, count, reverseOrder)
567572
}
568573

569574
// GettLatestThisGroupMessageHistory 获取最新本群消息历史记录
570-
func (ctx *Ctx) GetLatestThisGroupMessageHistory() gjson.Result {
571-
return ctx.GetLatestGroupMessageHistory(ctx.Event.GroupID)
575+
func (ctx *Ctx) GetLatestThisGroupMessageHistory(count int64, reverseOrder bool) gjson.Result {
576+
return ctx.GetLatestGroupMessageHistory(ctx.Event.GroupID, count, reverseOrder)
572577
}
573578

574579
// GetGroupEssenceMessageList 获取群精华消息列表

0 commit comments

Comments
 (0)