go-telegram / bot

Telegram Bot API Go framework
MIT License
502 stars 46 forks source link

models.InputFileUpload without pointer compiles but does not work #51

Closed Vasilesk closed 4 months ago

Vasilesk commented 6 months ago

This code compiles and works fine:

b.SendDocument(ctx, &bot.SendDocumentParams{
    ChatID:   123,
    Document: &models.InputFileUpload{Filename: "my.txt", Data: myReader},
})

The same code but without & before models.InputFileUpload fails with the next error:

unexpected response statusCode 400 for method sendDocument, {"ok":false,"error_code":400,"description":"Bad Request: invalid file HTTP URL specified: Wrong port number specified in the URL"

Expected behaviour: this should also work (or just fail with an obvious error message).

negasus commented 5 months ago

By library API design, models.InputFileUpload should be provided by pointer. I'm not sure this needs to change. It breaking change

negasus commented 4 months ago

Closed