mirror of
https://github.com/42wim/matterbridge.git
synced 2025-01-30 22:14:13 +01:00
telegram: Add authorship caption even when file comment is empty
This commit is contained in:
parent
5b73a5d04b
commit
85a46f95fd
@ -538,21 +538,15 @@ func (b *Btelegram) handleUploadFile(msg *config.Message, chatid int64, threadid
|
||||
switch filepath.Ext(fi.Name) {
|
||||
case ".jpg", ".jpe", ".png":
|
||||
pc := tgbotapi.NewInputMediaPhoto(file)
|
||||
if fi.Comment != "" {
|
||||
pc.Caption, pc.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
}
|
||||
pc.Caption, pc.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
media = append(media, pc)
|
||||
case ".mp4", ".m4v":
|
||||
vc := tgbotapi.NewInputMediaVideo(file)
|
||||
if fi.Comment != "" {
|
||||
vc.Caption, vc.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
}
|
||||
vc.Caption, vc.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
media = append(media, vc)
|
||||
case ".mp3", ".oga":
|
||||
ac := tgbotapi.NewInputMediaAudio(file)
|
||||
if fi.Comment != "" {
|
||||
ac.Caption, ac.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
}
|
||||
ac.Caption, ac.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
media = append(media, ac)
|
||||
case ".ogg":
|
||||
voc := tgbotapi.NewVoice(chatid, file)
|
||||
@ -565,9 +559,7 @@ func (b *Btelegram) handleUploadFile(msg *config.Message, chatid int64, threadid
|
||||
return strconv.Itoa(res.MessageID), nil
|
||||
default:
|
||||
dc := tgbotapi.NewInputMediaDocument(file)
|
||||
if fi.Comment != "" {
|
||||
dc.Caption, dc.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
}
|
||||
dc.Caption, dc.ParseMode = TGGetParseMode(b, msg.Username, fi.Comment)
|
||||
media = append(media, dc)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user