mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
Merge pull request #1811 from xiangxiangxiong9/dev
groupJoinReqEvent添加字段 invitor_id
This commit is contained in:
commit
6bb98fc1df
@ -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)
|
log.Infof("收到来自群 %v(%v) 内用户 %v(%v) 的加群邀请.", e.GroupName, e.GroupCode, e.InvitorNick, e.InvitorUin)
|
||||||
flag := strconv.FormatInt(e.RequestId, 10)
|
flag := strconv.FormatInt(e.RequestId, 10)
|
||||||
bot.dispatchEvent("request/group/invite", global.MSG{
|
bot.dispatchEvent("request/group/invite", global.MSG{
|
||||||
"group_id": e.GroupCode,
|
"group_id": e.GroupCode,
|
||||||
"user_id": e.InvitorUin,
|
"user_id": e.InvitorUin,
|
||||||
"comment": "",
|
"invitor_id": 0,
|
||||||
"flag": flag,
|
"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)
|
log.Infof("群 %v(%v) 收到来自用户 %v(%v) 的加群请求.", e.GroupName, e.GroupCode, e.RequesterNick, e.RequesterUin)
|
||||||
flag := strconv.FormatInt(e.RequestId, 10)
|
flag := strconv.FormatInt(e.RequestId, 10)
|
||||||
bot.dispatchEvent("request/group/add", global.MSG{
|
bot.dispatchEvent("request/group/add", global.MSG{
|
||||||
"group_id": e.GroupCode,
|
"group_id": e.GroupCode,
|
||||||
"user_id": e.RequesterUin,
|
"user_id": e.RequesterUin,
|
||||||
"comment": e.Message,
|
"invitor_id": e.ActionUin,
|
||||||
"flag": flag,
|
"comment": e.Message,
|
||||||
|
"flag": flag,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@ func Quote(s string) string {
|
|||||||
return quoteWith(s, '"', false, false)
|
return quoteWith(s, '"', false, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func quoteWith(s string, quote byte, ASCIIonly, graphicOnly bool) string {
|
func quoteWith(s string, quote byte, asciiOnly, graphicOnly bool) string {
|
||||||
return string(appendQuotedWith(make([]byte, 0, 3*len(s)/2), s, quote, ASCIIonly, graphicOnly))
|
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,
|
// Often called with big strings, so preallocate. If there's quoting,
|
||||||
// this is conservative but still helps a lot.
|
// this is conservative but still helps a lot.
|
||||||
if cap(buf)-len(buf) < len(s) {
|
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])
|
buf = append(buf, lowerhex[s[0]&0xF])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
buf = appendEscapedRune(buf, r, quote, ASCIIonly, graphicOnly)
|
buf = appendEscapedRune(buf, r, quote, asciiOnly, graphicOnly)
|
||||||
}
|
}
|
||||||
buf = append(buf, quote)
|
buf = append(buf, quote)
|
||||||
return buf
|
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
|
var runeTmp [utf8.UTFMax]byte
|
||||||
if r == rune(quote) || r == '\\' { // always backslashed
|
if r == rune(quote) || r == '\\' { // always backslashed
|
||||||
buf = append(buf, '\\')
|
buf = append(buf, '\\')
|
||||||
buf = append(buf, byte(r))
|
buf = append(buf, byte(r))
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
if ASCIIonly {
|
if asciiOnly {
|
||||||
if r < utf8.RuneSelf && strconv.IsPrint(r) {
|
if r < utf8.RuneSelf && strconv.IsPrint(r) {
|
||||||
buf = append(buf, byte(r))
|
buf = append(buf, byte(r))
|
||||||
return buf
|
return buf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user