Fix role mention replacement (#509)
* Fix role mention replacement * Fix message test too
This commit is contained in:
parent
7f8369a45f
commit
ffa9956c9b
2 changed files with 2 additions and 2 deletions
|
@ -237,7 +237,7 @@ func (m *Message) ContentWithMoreMentionsReplaced(s *Session) (content string, e
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
content = strings.Replace(content, "<&"+role.ID+">", "@"+role.Name, -1)
|
content = strings.Replace(content, "<@&"+role.ID+">", "@"+role.Name, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
content = patternChannels.ReplaceAllStringFunc(content, func(mention string) string {
|
content = patternChannels.ReplaceAllStringFunc(content, func(mention string) string {
|
||||||
|
|
|
@ -30,7 +30,7 @@ func TestContentWithMoreMentionsReplaced(t *testing.T) {
|
||||||
ID: "channel",
|
ID: "channel",
|
||||||
})
|
})
|
||||||
m := &Message{
|
m := &Message{
|
||||||
Content: "<&role> <@!user> <@user> <#channel>",
|
Content: "<@&role> <@!user> <@user> <#channel>",
|
||||||
ChannelID: "channel",
|
ChannelID: "channel",
|
||||||
MentionRoles: []string{"role"},
|
MentionRoles: []string{"role"},
|
||||||
Mentions: []*User{user},
|
Mentions: []*User{user},
|
||||||
|
|
Loading…
Reference in a new issue