Skip to content

Commit e211acf

Browse files
committed
fix(message): MentionList
1 parent 6d8b30f commit e211acf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

wechaty/config/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ package config
22

33
import (
44
"github.com/wechaty/go-wechaty/wechaty-puppet/filebox"
5+
"regexp"
56
)
67

78
// AtSepratorRegex mobile: \u2005, PC、mac: \u0020
9+
// Deprecated: use AtSeparatorRegexStr
810
const AtSepratorRegex = "[\u2005\u0020]"
911

12+
// AtSeparatorRegexStr mobile: \u2005, PC、mac: \u0020
13+
const AtSeparatorRegexStr = "[\u2005\u0020]"
14+
1015
const FourPerEmSpace = string(rune(8197))
1116

17+
var AtSeparatorRegex = regexp.MustCompile(AtSeparatorRegexStr)
18+
1219
func QRCodeForChatie() *filebox.FileBox {
1320
const chatieOfficialAccountQrcode = "http://weixin.qq.com/r/qymXj7DEO_1ErfTs93y5"
1421
return filebox.FromQRCode(chatieOfficialAccountQrcode)

wechaty/user/message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (m *Message) MentionList() []_interface.IContact {
257257
return contactList
258258
}
259259

260-
atList := strings.Split(m.Text(), config.AtSepratorRegex)
260+
atList := config.AtSeparatorRegex.Split(m.Text(), -1)
261261
if len(atList) == 0 {
262262
return nil
263263
}

0 commit comments

Comments
 (0)