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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user