forked from jshiffer/matterbridge
Return a message ID when sending with a webhook (discord) (#1976)
Resolves #1975
This commit is contained in:
parent
d42277979a
commit
839f384e45
@ -47,8 +47,9 @@ func (b *Bdiscord) maybeGetLocalAvatar(msg *config.Message) string {
|
|||||||
// Returns messageID and error.
|
// Returns messageID and error.
|
||||||
func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordgo.Message, error) {
|
func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordgo.Message, error) {
|
||||||
var (
|
var (
|
||||||
res *discordgo.Message
|
res *discordgo.Message
|
||||||
err error
|
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)
|
// 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
|
content := fi.Comment
|
||||||
|
|
||||||
_, e2 := b.transmitter.Send(
|
res2, err = b.transmitter.Send(
|
||||||
channelID,
|
channelID,
|
||||||
&discordgo.WebhookParams{
|
&discordgo.WebhookParams{
|
||||||
Username: msg.Username,
|
Username: msg.Username,
|
||||||
@ -94,11 +95,16 @@ func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordg
|
|||||||
AllowedMentions: b.getAllowedMentions(),
|
AllowedMentions: b.getAllowedMentions(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if e2 != nil {
|
if err != nil {
|
||||||
b.Log.Errorf("Could not send file %#v for message %#v: %s", file, msg, e2)
|
b.Log.Errorf("Could not send file %#v for message %#v: %s", file, msg, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if msg.Text == "" {
|
||||||
|
res = res2
|
||||||
|
}
|
||||||
|
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user