0.8.0 beta 2

This commit is contained in:
2026-02-19 13:33:27 +03:00
parent 7b9292557e
commit 1bf7499496
3 changed files with 18 additions and 15 deletions

View File

@@ -1,5 +1,11 @@
package tgapi
import (
"fmt"
"io"
"net/http"
)
type ParseMode string
const (
@@ -44,3 +50,13 @@ func (api *API) GetFile(params GetFileP) (File, error) {
req := NewRequest[File]("getFile", params)
return req.Do(api)
}
func (api *API) GetFileByLink(link string) ([]byte, error) {
u := fmt.Sprintf("https://api.telegram.org/file/bot%s/%s", api.token, link)
res, err := http.Get(u)
if err != nil {
return nil, err
}
defer res.Body.Close()
return io.ReadAll(res.Body)
}