Allow pics without caption

This commit is contained in:
Hamcha 2019-05-23 16:56:19 +02:00
parent b7d6ea332a
commit 025a5b96fd
Signed by: hamcha
GPG Key ID: A40413D21021EAEE
1 changed files with 3 additions and 3 deletions

View File

@ -69,12 +69,12 @@ func mastodon_message(broker *tg.Broker, update tg.APIMessage) {
update.Text = update.ReplyTo.Text
if update.ReplyTo.Photo != nil {
update.Photo = update.ReplyTo.Photo
update.Caption = update.Text
update.Caption = update.ReplyTo.Caption
}
}
// Check for media
if update.Photo != nil && update.Caption != nil {
if update.Photo != nil {
maxsz := 0
photo := tg.APIPhotoSize{}
for _, curphoto := range update.Photo {
@ -83,7 +83,7 @@ func mastodon_message(broker *tg.Broker, update tg.APIMessage) {
photo = curphoto
}
}
go broker.GetFile(photo.FileID, func(broker *tg.Broker, data tg.BrokerUpdate) {
broker.GetFile(photo.FileID, func(broker *tg.Broker, data tg.BrokerUpdate) {
if data.Type == tg.BError {
log.Printf("[mastodon] Received error from broker: %s\n", *data.Error)
broker.SendTextMessage(update.Chat, "<b>ERRORE!</b> @hamcha controlla la console!", &tg.MessageOptions{