1
0

Added GetUserProfilePhotos method

This commit is contained in:
Maxim Lebedev 2017-12-14 12:39:12 +05:00
parent 4cf8e0445c
commit 4524b2bed9
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F

View File

@ -0,0 +1,29 @@
package telegram
import (
"strconv"
json "github.com/pquerna/ffjson/ffjson"
http "github.com/valyala/fasthttp"
)
// GetUserProfilePhotos get a list of profile pictures for a user. Returns a UserProfilePhotos object.
func (bot *Bot) GetUserProfilePhotos(userID, offset, limit int) (*UserProfilePhotos, error) {
args := http.AcquireArgs()
defer http.ReleaseArgs(args)
args.Add("user_id", strconv.Itoa(userID))
args.Add("offset", strconv.Itoa(offset))
if limit > 0 {
args.Add("limit", strconv.Itoa(limit))
}
resp, err := bot.request(nil, "getUserProfilePhotos", args)
if err != nil {
return nil, err
}
var data UserProfilePhotos
err = json.Unmarshal(*resp.Result, &data)
return &data, err
}