From 4d2207aba7698fe5ed46c9ad5bc012ee93b68ef5 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 16 Apr 2017 00:16:24 +0200 Subject: [PATCH] Add support for edited messages (slack) --- bridge/slack/slack.go | 5 +++++ changelog.md | 1 + matterbridge.toml.sample | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 5de6cf9b..9c9f3fc3 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -199,6 +199,11 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) { // ignore first message if count > 0 { flog.Debugf("Receiving from slackclient %#v", ev) + if !b.Config.EditDisable && ev.SubMessage != nil { + flog.Debugf("SubMessage %#v", ev.SubMessage) + ev.User = ev.SubMessage.User + ev.Text = ev.SubMessage.Text + b.Config.EditSuffix + } // use our own func because rtm.GetChannelInfo doesn't work for private channels channel, err := b.getChannelByID(ev.Channel) if err != nil { diff --git a/changelog.md b/changelog.md index fd640095..035ac2e9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # v0.12.0 ## Changes +* general: edited messages are now being sent by default on discord/mattermost/telegram/gitter/slack. See "New Features" * gitter: The default support for edited messages enables experimental FAYE support for gitter. If you need stable code add EditDisable=true to your gitter configuration. diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index a54da452..531dba7b 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -364,6 +364,14 @@ NickFormatter="plain" #OPTIONAL (default 4) NicksPerRow=4 +#Disable sending of edits to other bridges +#OPTIONAL (default false) +EditDisable=true + +#Message to be appended to every edited message +#OPTIONAL (default empty) +EditSuffix=" (edited)" + #Whether to prefix messages from other bridges to mattermost with RemoteNickFormat #Useful if username overrides for incoming webhooks isn't enabled on the #slack server. If you set PrefixMessagesWithNick to true, each message