From 0b4826751e01c92fbed317f313e8ee5f4368f623 Mon Sep 17 00:00:00 2001 From: NikkyAI Date: Wed, 26 Sep 2018 23:58:28 +0200 Subject: [PATCH] =?UTF-8?q?fix=20discord=20mentions=20cutt=C3=ADng=20off?= =?UTF-8?q?=20all=20text=20after=20the=20mention?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bridge/discord/discord.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index 9d7e2d69..dae3fe1b 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -407,11 +407,12 @@ func (b *Bdiscord) replaceUserMentions(text string) string { mention := strings.TrimSpace(m[1:]) var member *discordgo.Member var err error + var lastSpace int for { b.Log.Debugf("Testing mention: '%s'", mention) member, err = b.getGuildMemberByNick(mention) if err != nil { - lastSpace := strings.LastIndex(mention, " ") + lastSpace = strings.LastIndex(mention, " ") if lastSpace == -1 { break } @@ -423,7 +424,7 @@ func (b *Bdiscord) replaceUserMentions(text string) string { if err != nil { return m } - return member.User.Mention() + return member.User.Mention() + " " + m[lastSpace+2:] }) b.Log.Debugf("Message with mention replaced: %s", text) return text