5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-09 16:50:30 +00:00

Show file comment in webhook if normal message is empty (discord). Fixes #962 (#995)

This commit is contained in:
Wim 2020-02-02 21:14:54 +01:00 committed by GitHub
parent 0898829313
commit b85bae31d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -407,6 +407,10 @@ func (b *Bdiscord) webhookSend(msg *config.Message, webhookID, token string) (*d
ContentType: "", ContentType: "",
Reader: bytes.NewReader(*fi.Data), Reader: bytes.NewReader(*fi.Data),
} }
content := ""
if msg.Text == "" {
content = fi.Comment
}
_, e2 := b.c.WebhookExecute( _, e2 := b.c.WebhookExecute(
webhookID, webhookID,
token, token,
@ -415,6 +419,7 @@ func (b *Bdiscord) webhookSend(msg *config.Message, webhookID, token string) (*d
Username: msg.Username, Username: msg.Username,
AvatarURL: msg.Avatar, AvatarURL: msg.Avatar,
File: &file, File: &file,
Content: content,
}, },
) )
if e2 != nil { if e2 != nil {