commit 938a15c6889470cf8409d0134faf35643f149945
Author: Wim <wim@42.be>
Date: Sat Apr 15 16:23:34 2017 +0000
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index 1cf8133..f1ab4a7 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -46 +47 @@ import (
"github.com/42wim/matterbridge/bridge/config"
log "github.com/Sirupsen/logrus"
"github.com/bwmarrin/discordgo"
+ "regexp"
"strings"
"sync"
)
@@ -1256 +1267 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
if len(m.MentionRoles) > 0 {
m.Message.Content = b.replaceRoleMentions(m.Message.Content)
}
+ m.Message.Content = b.stripCustomoji(m.Message.Content)
b.Remote <- config.Message{Username: username, Text: m.ContentWithMentionsReplaced(), Channel: channelName,
Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg"}
}
@@ -1953 +1979 @@ func (b *bdiscord) replaceRoleMentions(text string) string {
}
return text
}
+
+func (b *bdiscord) stripCustomoji(text string) string {
+ // <:doge:302803592035958784>
+ re := regexp.MustCompile("<(:.*?:)[0-9]+>")
+ return re.ReplaceAllString(text, `$1`)
+}