diff options
author | Joseph Mansy <36427684+yousefmansy1@users.noreply.github.com> | 2023-03-14 15:16:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 23:16:22 +0100 |
commit | 839f384e45ce518e3ed67a9f51b4593b28c1a79b (patch) | |
tree | 2eb6de371426551d6482768f8075f9fb8d9bbc57 /bridge/discord | |
parent | d42277979abcefe885bb068cad989eaf71460872 (diff) | |
download | matterbridge-msglm-839f384e45ce518e3ed67a9f51b4593b28c1a79b.tar.gz matterbridge-msglm-839f384e45ce518e3ed67a9f51b4593b28c1a79b.tar.bz2 matterbridge-msglm-839f384e45ce518e3ed67a9f51b4593b28c1a79b.zip |
Return a message ID when sending with a webhook (discord) (#1976)
Resolves #1975
Diffstat (limited to 'bridge/discord')
-rw-r--r-- | bridge/discord/webhook.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bridge/discord/webhook.go b/bridge/discord/webhook.go index c34fc945..b518ea62 100644 --- a/bridge/discord/webhook.go +++ b/bridge/discord/webhook.go @@ -47,8 +47,9 @@ 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) @@ -84,7 +85,7 @@ 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, @@ -94,11 +95,16 @@ 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 } |