0.8.0 beta 2
This commit is contained in:
13
methods.go
13
methods.go
@@ -2,9 +2,6 @@ package laniakea
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"git.nix13.pw/scuroneko/laniakea/tgapi"
|
"git.nix13.pw/scuroneko/laniakea/tgapi"
|
||||||
)
|
)
|
||||||
@@ -39,13 +36,3 @@ func (bot *Bot[T]) Updates() ([]tgapi.Update, error) {
|
|||||||
}
|
}
|
||||||
return updates, err
|
return updates, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bot *Bot[T]) GetFileByLink(link string) ([]byte, error) {
|
|
||||||
u := fmt.Sprintf("https://api.telegram.org/file/bot%s/%s", bot.token, link)
|
|
||||||
res, err := http.Get(u)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer res.Body.Close()
|
|
||||||
return io.ReadAll(res.Body)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package tgapi
|
package tgapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
type ParseMode string
|
type ParseMode string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -44,3 +50,13 @@ func (api *API) GetFile(params GetFileP) (File, error) {
|
|||||||
req := NewRequest[File]("getFile", params)
|
req := NewRequest[File]("getFile", params)
|
||||||
return req.Do(api)
|
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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VersionString = "0.8.0-beta.1"
|
VersionString = "0.8.0-beta.2"
|
||||||
VersionMajor = 0
|
VersionMajor = 0
|
||||||
VersionMinor = 8
|
VersionMinor = 8
|
||||||
VersionPatch = 0
|
VersionPatch = 0
|
||||||
Beta = 1
|
Beta = 2
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user