Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 1db6c6689a9d6da8cb87edb9d2ac502c7fb625a4 Author: Joseph Mansy <36427684+yousefmansy1@users.noreply.github.com> Date: Tue Mar 14 15:16:22 2023 +0000 Return a message ID when sending with a webhook (discord) (#1976) Resolves #1975 diff --git a/bridge/discord/webhook.go b/bridge/discord/webhook.go index c34fc94..b518ea6 100644 --- a/bridge/discord/webhook.go +++ b/bridge/discord/webhook.go @@ -478 +479 @@ func (b *Bdiscord) maybeGetLocalAvatar(msg *config.Message) string {  // Returns messageID and error.  func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordgo.Message, error) {   var ( - res *discordgo.Message - err error + res *discordgo.Message + res2 *discordgo.Message + err error   )     // If avatar is unset, mutate the message to include the local avatar (but only if settings say we should do this) @@ -847 +857 @@ func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordg   }   content := fi.Comment   - _, e2 := b.transmitter.Send( + res2, err = b.transmitter.Send(   channelID,   &discordgo.WebhookParams{   Username: msg.Username, @@ -9411 +9516 @@ func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordg   AllowedMentions: b.getAllowedMentions(),   },   ) - if e2 != nil { - b.Log.Errorf("Could not send file %#v for message %#v: %s", file, msg, e2) + if err != nil { + b.Log.Errorf("Could not send file %#v for message %#v: %s", file, msg, err)   }   }   } + + if msg.Text == "" { + res = res2 + } +   return res, err  }