From b05a64fc1b873756dc7da40e35f728aed5e0df45 Mon Sep 17 00:00:00 2001 From: xiangxiangxiong9 <1296976552@qq.com> Date: Tue, 20 Dec 2022 20:37:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=82=80=E8=AF=B7=E5=85=A5=E7=BE=A4?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=82=80=E8=AF=B7=E4=BA=BAid=20[invitor=5Fid?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coolq/event.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/coolq/event.go b/coolq/event.go index 02c4da6..51492ef 100644 --- a/coolq/event.go +++ b/coolq/event.go @@ -543,10 +543,11 @@ func (bot *CQBot) groupInvitedEvent(c *client.QQClient, e *client.GroupInvitedRe log.Infof("收到来自群 %v(%v) 内用户 %v(%v) 的加群邀请.", e.GroupName, e.GroupCode, e.InvitorNick, e.InvitorUin) flag := strconv.FormatInt(e.RequestId, 10) bot.dispatchEvent("request/group/invite", global.MSG{ - "group_id": e.GroupCode, - "user_id": e.InvitorUin, - "comment": "", - "flag": flag, + "group_id": e.GroupCode, + "user_id": e.InvitorUin, + "invitor_id": 0, + "comment": "", + "flag": flag, }) } @@ -554,10 +555,11 @@ func (bot *CQBot) groupJoinReqEvent(c *client.QQClient, e *client.UserJoinGroupR log.Infof("群 %v(%v) 收到来自用户 %v(%v) 的加群请求.", e.GroupName, e.GroupCode, e.RequesterNick, e.RequesterUin) flag := strconv.FormatInt(e.RequestId, 10) bot.dispatchEvent("request/group/add", global.MSG{ - "group_id": e.GroupCode, - "user_id": e.RequesterUin, - "comment": e.Message, - "flag": flag, + "group_id": e.GroupCode, + "user_id": e.RequesterUin, + "invitor_id": e.ActionUin, + "comment": e.Message, + "flag": flag, }) } From 02aadaf63ce130e81e0b89f3caa738245bba3266 Mon Sep 17 00:00:00 2001 From: xiangxiangxiong9 <1296976552@qq.com> Date: Tue, 20 Dec 2022 21:03:31 +0800 Subject: [PATCH 2/2] make lint happy --- global/quote.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/global/quote.go b/global/quote.go index bad54b9..6e61218 100644 --- a/global/quote.go +++ b/global/quote.go @@ -18,11 +18,11 @@ func Quote(s string) string { return quoteWith(s, '"', false, false) } -func quoteWith(s string, quote byte, ASCIIonly, graphicOnly bool) string { - return string(appendQuotedWith(make([]byte, 0, 3*len(s)/2), s, quote, ASCIIonly, graphicOnly)) +func quoteWith(s string, quote byte, asciiOnly, graphicOnly bool) string { + return string(appendQuotedWith(make([]byte, 0, 3*len(s)/2), s, quote, asciiOnly, graphicOnly)) } -func appendQuotedWith(buf []byte, s string, quote byte, ASCIIonly, graphicOnly bool) []byte { +func appendQuotedWith(buf []byte, s string, quote byte, asciiOnly, graphicOnly bool) []byte { // Often called with big strings, so preallocate. If there's quoting, // this is conservative but still helps a lot. if cap(buf)-len(buf) < len(s) { @@ -43,19 +43,19 @@ func appendQuotedWith(buf []byte, s string, quote byte, ASCIIonly, graphicOnly b buf = append(buf, lowerhex[s[0]&0xF]) continue } - buf = appendEscapedRune(buf, r, quote, ASCIIonly, graphicOnly) + buf = appendEscapedRune(buf, r, quote, asciiOnly, graphicOnly) } buf = append(buf, quote) return buf } -func appendEscapedRune(buf []byte, r rune, quote byte, ASCIIonly, graphicOnly bool) []byte { +func appendEscapedRune(buf []byte, r rune, quote byte, asciiOnly, graphicOnly bool) []byte { var runeTmp [utf8.UTFMax]byte if r == rune(quote) || r == '\\' { // always backslashed buf = append(buf, '\\') buf = append(buf, byte(r)) return buf } - if ASCIIonly { + if asciiOnly { if r < utf8.RuneSelf && strconv.IsPrint(r) { buf = append(buf, byte(r)) return buf