Add support for edited messages (slack)

This commit is contained in:
Wim 2017-04-16 00:16:24 +02:00
parent 17b8b86d68
commit 4d2207aba7
3 changed files with 14 additions and 0 deletions

View File

@ -199,6 +199,11 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {
// ignore first message // ignore first message
if count > 0 { if count > 0 {
flog.Debugf("Receiving from slackclient %#v", ev) 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 // use our own func because rtm.GetChannelInfo doesn't work for private channels
channel, err := b.getChannelByID(ev.Channel) channel, err := b.getChannelByID(ev.Channel)
if err != nil { if err != nil {

View File

@ -1,5 +1,6 @@
# v0.12.0 # v0.12.0
## Changes ## 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. * 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. If you need stable code add EditDisable=true to your gitter configuration.

View File

@ -364,6 +364,14 @@ NickFormatter="plain"
#OPTIONAL (default 4) #OPTIONAL (default 4)
NicksPerRow=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 #Whether to prefix messages from other bridges to mattermost with RemoteNickFormat
#Useful if username overrides for incoming webhooks isn't enabled on the #Useful if username overrides for incoming webhooks isn't enabled on the
#slack server. If you set PrefixMessagesWithNick to true, each message #slack server. If you set PrefixMessagesWithNick to true, each message