From 6256c066f11466784fd35f45549ac643dcec790f Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 9 Jul 2017 13:59:50 +0200 Subject: Replace :emoji: with unicode chars. #215 Add vendor github.com/peterhellberg/emojilib --- gateway/gateway.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gateway') diff --git a/gateway/gateway.go b/gateway/gateway.go index be09ac76..03d6aa92 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -5,6 +5,7 @@ import ( "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" log "github.com/Sirupsen/logrus" + "github.com/peterhellberg/emojilib" // "github.com/davecgh/go-spew/spew" "regexp" "strings" @@ -116,6 +117,7 @@ func (gw *Gateway) handleReceive() { } if !gw.ignoreMessage(&msg) { msg.Timestamp = time.Now() + gw.modifyMessage(&msg) for _, br := range gw.Bridges { gw.handleMessage(msg, br) } @@ -296,6 +298,11 @@ func (gw *Gateway) modifyAvatar(msg *config.Message, dest *bridge.Bridge) { } } +func (gw *Gateway) modifyMessage(msg *config.Message) { + // replace :emoji: to unicode + msg.Text = emojilib.Replace(msg.Text) +} + func getChannelID(msg config.Message) string { return msg.Channel + msg.Account } -- cgit v1.2.3