Allow pics without caption
This commit is contained in:
parent
b7d6ea332a
commit
025a5b96fd
1 changed files with 3 additions and 3 deletions
|
@ -69,12 +69,12 @@ func mastodon_message(broker *tg.Broker, update tg.APIMessage) {
|
||||||
update.Text = update.ReplyTo.Text
|
update.Text = update.ReplyTo.Text
|
||||||
if update.ReplyTo.Photo != nil {
|
if update.ReplyTo.Photo != nil {
|
||||||
update.Photo = update.ReplyTo.Photo
|
update.Photo = update.ReplyTo.Photo
|
||||||
update.Caption = update.Text
|
update.Caption = update.ReplyTo.Caption
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for media
|
// Check for media
|
||||||
if update.Photo != nil && update.Caption != nil {
|
if update.Photo != nil {
|
||||||
maxsz := 0
|
maxsz := 0
|
||||||
photo := tg.APIPhotoSize{}
|
photo := tg.APIPhotoSize{}
|
||||||
for _, curphoto := range update.Photo {
|
for _, curphoto := range update.Photo {
|
||||||
|
@ -83,7 +83,7 @@ func mastodon_message(broker *tg.Broker, update tg.APIMessage) {
|
||||||
photo = curphoto
|
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 {
|
if data.Type == tg.BError {
|
||||||
log.Printf("[mastodon] Received error from broker: %s\n", *data.Error)
|
log.Printf("[mastodon] Received error from broker: %s\n", *data.Error)
|
||||||
broker.SendTextMessage(update.Chat, "<b>ERRORE!</b> @hamcha controlla la console!", &tg.MessageOptions{
|
broker.SendTextMessage(update.Chat, "<b>ERRORE!</b> @hamcha controlla la console!", &tg.MessageOptions{
|
||||||
|
|
Reference in a new issue