mirror of
https://github.com/usememos/memos.git
synced 2024-12-26 07:01:17 +08:00
845297ec03
* Change all `Robot` to `Bot` * Change all `r` of `Bot` to `b` * Change `Robot` to `bot` in comments * Fix typo --------- Co-authored-by: Athurg Feng <athurg@gooth.org>
21 lines
375 B
Go
21 lines
375 B
Go
package telegram
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
)
|
|
|
|
// GetFile get download info of File by fileID from Telegram.
|
|
func (b *Bot) GetFile(ctx context.Context, fileID string) (*File, error) {
|
|
formData := url.Values{
|
|
"file_id": {fileID},
|
|
}
|
|
|
|
var result File
|
|
err := b.postForm(ctx, "/getFile", formData, &result)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &result, nil
|
|
}
|