mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
parent
9c95a906b6
commit
5c8fa7f9a0
@ -10,7 +10,7 @@
|
||||
- [x] HTTP API
|
||||
- [x] 反向HTTP POST
|
||||
- [x] 正向Websocket
|
||||
- [x] 反向Websocket (测试中)
|
||||
- [x] 反向Websocket
|
||||
|
||||
#### 拓展支持
|
||||
- [x] HTTP POST多点上报
|
||||
|
@ -75,7 +75,7 @@ func (bot *CQBot) GetGroupMessage(mid int32) MSG {
|
||||
return err
|
||||
}
|
||||
buff := new(bytes.Buffer)
|
||||
buff.Write(e.Value)
|
||||
buff.Write(binary.GZipUncompress(e.Value))
|
||||
return gob.NewDecoder(buff).Decode(&m)
|
||||
})
|
||||
if err == nil {
|
||||
@ -140,7 +140,7 @@ func (bot *CQBot) InsertGroupMessage(m *message.GroupMessage) int32 {
|
||||
if err := gob.NewEncoder(buf).Encode(val); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Put("group-messages", binary.ToBytes(id), buf.Bytes(), 0)
|
||||
return tx.Put("group-messages", binary.ToBytes(id), binary.GZipCompress(buf.Bytes()), 0)
|
||||
})
|
||||
if err != nil {
|
||||
log.Warnf("记录聊天数据时出现错误: %v", err)
|
||||
|
@ -286,7 +286,7 @@ func (s *httpServer) SetGroupKick(c *gin.Context) {
|
||||
func (s *httpServer) SetGroupBan(c *gin.Context) {
|
||||
gid, _ := strconv.ParseInt(getParam(c, "group_id"), 10, 64)
|
||||
uid, _ := strconv.ParseInt(getParam(c, "user_id"), 10, 64)
|
||||
i, _ := strconv.ParseInt(getParam(c, "duration"), 10, 64)
|
||||
i, _ := strconv.ParseInt(getParamOrDefault(c, "duration", "1800"), 10, 64)
|
||||
c.JSON(200, s.bot.CQSetGroupBan(gid, uid, uint32(i)))
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,12 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
|
||||
return bot.CQSetGroupKick(p.Get("group_id").Int(), p.Get("user_id").Int(), p.Get("message").Str)
|
||||
},
|
||||
"set_group_ban": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||
return bot.CQSetGroupBan(p.Get("group_id").Int(), p.Get("user_id").Int(), uint32(p.Get("duration").Int()))
|
||||
return bot.CQSetGroupBan(p.Get("group_id").Int(), p.Get("user_id").Int(), func() uint32 {
|
||||
if p.Get("duration").Exists() {
|
||||
return uint32(p.Get("duration").Int())
|
||||
}
|
||||
return 1800
|
||||
}())
|
||||
},
|
||||
"set_group_whole_ban": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||
return bot.CQSetGroupWholeBan(p.Get("group_id").Int(), func() bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user