mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
375 B
Go
22 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
|
|
}
|