1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-07 12:43:32 +08:00

feat add group notice.

This commit is contained in:
Mrs4s 2021-02-20 18:35:42 +08:00
parent 7a72473daa
commit 46442e9b2f

View File

@ -8,6 +8,7 @@ import (
"math"
"math/rand"
"net"
"net/url"
"runtime/debug"
"sort"
"strconv"
@ -380,6 +381,15 @@ func (c *QQClient) GetGroupHonorInfo(groupCode int64, honorType HonorType) (*Gro
return &ret, nil
}
func (c *QQClient) AddGroupNoticeSimple(groupCode int64, text string) error {
body := fmt.Sprintf(`qid=%v&bkn=%v&text=%v&pinned=0&type=1&settings={"is_show_edit_card":0,"tip_window_type":1,"confirm_required":1}`, groupCode, c.getCSRFToken(), url.QueryEscape(text))
_, err := utils.HttpPostBytesWithCookie("https://web.qun.qq.com/cgi-bin/announce/add_qun_notice?bkn="+fmt.Sprint(c.getCSRFToken()), []byte(body), c.getCookiesWithDomain("qun.qq.com"))
if err != nil {
return errors.Wrap(err, "request error")
}
return nil
}
func (c *QQClient) GetWordSegmentation(text string) ([]string, error) {
rsp, err := c.sendAndWait(c.buildWordSegmentationPacket([]byte(text)))
if err != nil {