4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 08:39:24 +00:00

Replace :emoji: with unicode chars. #215

Add vendor github.com/peterhellberg/emojilib
This commit is contained in:
Wim
2017-07-09 13:59:50 +02:00
parent 870b89a8f0
commit 6256c066f1
5 changed files with 19742 additions and 0 deletions

View File

@ -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
}