summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridge/discord/discord.go13
-rw-r--r--matterbridge.toml.sample8
2 files changed, 21 insertions, 0 deletions
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index f1ab4a76..2a91adf9 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -52,6 +52,7 @@ func (b *bdiscord) Connect() error {
flog.Info("Connection succeeded")
b.c.AddHandler(b.messageCreate)
b.c.AddHandler(b.memberUpdate)
+ b.c.AddHandler(b.messageUpdate)
err = b.c.Open()
if err != nil {
flog.Debugf("%#v", err)
@@ -104,6 +105,18 @@ func (b *bdiscord) Send(msg config.Message) error {
return nil
}
+func (b *bdiscord) messageUpdate(s *discordgo.Session, m *discordgo.MessageUpdate) {
+ if b.Config.EditDisable {
+ return
+ }
+ // only when message is actually edited
+ if m.Message.EditedTimestamp != "" {
+ flog.Debugf("Sending edit message")
+ m.Content = m.Content + b.Config.EditSuffix
+ b.messageCreate(s, (*discordgo.MessageCreate)(m))
+ }
+}
+
func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
// not relay our own messages
if m.Author.Username == b.Nick {
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index d1dc0f41..2b2ee822 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -391,6 +391,14 @@ Token="Yourtokenhere"
#REQUIRED
Server="yourservername"
+#Disable sending of edits to other bridges
+#OPTIONAL (default false)
+EditDisable=false
+
+#Message to be appended to every edited message
+#OPTIONAL (default empty)
+EditSuffix=" (edited)"
+
#Nicks you want to ignore.
#Messages from those users will not be sent to other bridges.
#OPTIONAL