1
0
telegram/get_chat_members_count.go
2017-10-05 16:31:53 +05:00

24 lines
516 B
Go

package telegram
import (
"strconv"
json "github.com/pquerna/ffjson/ffjson"
http "github.com/valyala/fasthttp"
)
// GetChatMembersCount get the number of members in a chat. Returns Int on success.
func (bot *Bot) GetChatMembersCount(chatID int64) (int, error) {
var args http.Args
args.Add("chat_id", strconv.FormatInt(chatID, 10))
resp, err := bot.request(nil, "getChatMembersCount", &args)
if err != nil {
return 0, err
}
var data int
err = json.Unmarshal(*resp.Result, &data)
return data, err
}