🐛 修复系统消息类型的Content为空的bug
This commit is contained in:
parent
26473a5320
commit
2db696d642
32
message.go
32
message.go
@ -388,21 +388,23 @@ func (m *Message) init(bot *Bot) {
|
|||||||
m.Raw = raw
|
m.Raw = raw
|
||||||
// 如果是群消息
|
// 如果是群消息
|
||||||
if m.IsSendByGroup() {
|
if m.IsSendByGroup() {
|
||||||
// 将Username和正文分开
|
if m.MsgType == MsgTypeText {
|
||||||
data := strings.Split(m.Content, ":<br/>")
|
// 将Username和正文分开
|
||||||
m.Content = strings.Join(data[1:], "")
|
data := strings.Split(m.Content, ":<br/>")
|
||||||
m.senderInGroupUserName = data[0]
|
m.Content = strings.Join(data[1:], "")
|
||||||
receiver, err := m.Receiver()
|
m.senderInGroupUserName = data[0]
|
||||||
if err == nil {
|
receiver, err := m.Receiver()
|
||||||
displayName := receiver.DisplayName
|
if err == nil {
|
||||||
if displayName == "" {
|
displayName := receiver.DisplayName
|
||||||
displayName = receiver.NickName
|
if displayName == "" {
|
||||||
}
|
displayName = receiver.NickName
|
||||||
// 判断是不是@消息
|
}
|
||||||
atFlag := "@" + displayName + "\u2005"
|
// 判断是不是@消息
|
||||||
if strings.Contains(m.Content, atFlag) {
|
atFlag := "@" + displayName + "\u2005"
|
||||||
m.isAt = true
|
if strings.Contains(m.Content, atFlag) {
|
||||||
m.Content = strings.Replace(m.Content, atFlag, "", -1)
|
m.isAt = true
|
||||||
|
m.Content = strings.Replace(m.Content, atFlag, "", -1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user