feat: implement telegram bot plugin (#1740)

This commit is contained in:
Athurg Gooth
2023-05-26 09:43:51 +08:00
committed by GitHub
parent a07d11e820
commit 1282fe732e
23 changed files with 577 additions and 15 deletions

View File

@ -0,0 +1,21 @@
package telegram
import (
"context"
"net/url"
)
// GetFile get download info of File by fileID from Telegram.
func (r *Robot) GetFile(ctx context.Context, fileID string) (*File, error) {
formData := url.Values{
"file_id": {fileID},
}
var result File
err := r.postForm(ctx, "/getFile", formData, &result)
if err != nil {
return nil, err
}
return &result, nil
}