mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-21 21:40:27 +00:00
Return a message ID when sending with a webhook (discord) (#1976)
Resolves #1975
This commit is contained in:
parent
d42277979a
commit
839f384e45
@ -48,6 +48,7 @@ func (b *Bdiscord) maybeGetLocalAvatar(msg *config.Message) string {
|
||||
func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordgo.Message, error) {
|
||||
var (
|
||||
res *discordgo.Message
|
||||
res2 *discordgo.Message
|
||||
err error
|
||||
)
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user