Fix role mention replacement (#509)

* Fix role mention replacement

* Fix message test too
This commit is contained in:
Wim 2018-02-15 00:05:22 +01:00 committed by Chris Rhodes
parent 7f8369a45f
commit ffa9956c9b
2 changed files with 2 additions and 2 deletions

View file

@ -237,7 +237,7 @@ func (m *Message) ContentWithMoreMentionsReplaced(s *Session) (content string, e
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 {

View file

@ -30,7 +30,7 @@ func TestContentWithMoreMentionsReplaced(t *testing.T) {
ID: "channel",
})
m := &Message{
Content: "<&role> <@!user> <@user> <#channel>",
Content: "<@&role> <@!user> <@user> <#channel>",
ChannelID: "channel",
MentionRoles: []string{"role"},
Mentions: []*User{user},