Skip to content

Commit

Permalink
fix(message): MentionList
Browse files Browse the repository at this point in the history
  • Loading branch information
dchaofei committed Oct 21, 2022
1 parent 6d8b30f commit e211acf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions wechaty/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ package config

import (
"github.com/wechaty/go-wechaty/wechaty-puppet/filebox"
"regexp"
)

// AtSepratorRegex mobile: \u2005, PC、mac: \u0020
// Deprecated: use AtSeparatorRegexStr
const AtSepratorRegex = "[\u2005\u0020]"

// AtSeparatorRegexStr mobile: \u2005, PC、mac: \u0020
const AtSeparatorRegexStr = "[\u2005\u0020]"

const FourPerEmSpace = string(rune(8197))

var AtSeparatorRegex = regexp.MustCompile(AtSeparatorRegexStr)

func QRCodeForChatie() *filebox.FileBox {
const chatieOfficialAccountQrcode = "http://weixin.qq.com/r/qymXj7DEO_1ErfTs93y5"
return filebox.FromQRCode(chatieOfficialAccountQrcode)
Expand Down
2 changes: 1 addition & 1 deletion wechaty/user/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (m *Message) MentionList() []_interface.IContact {
return contactList
}

atList := strings.Split(m.Text(), config.AtSepratorRegex)
atList := config.AtSeparatorRegex.Split(m.Text(), -1)
if len(atList) == 0 {
return nil
}
Expand Down

0 comments on commit e211acf

Please sign in to comment.