1
0
telegram/get_chat_members_count.go

27 lines
675 B
Go
Raw Normal View History

package telegram
import json "github.com/pquerna/ffjson/ffjson"
2017-09-04 20:54:28 +00:00
2018-04-19 13:02:15 +00:00
// GetChatMembersCountParameters represents data for GetChatMembersCount method.
type GetChatMembersCountParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
}
2017-10-06 07:55:54 +00:00
// GetChatMembersCount get the number of members in a chat. Returns Int on
// success.
2018-08-21 11:05:04 +00:00
func (bot *Bot) GetChatMembersCount(chatID int64) (count int, err error) {
dst, err := json.Marshal(&GetChatMembersCountParameters{ChatID: chatID})
if err != nil {
2018-08-21 11:05:04 +00:00
return
}
2018-04-12 11:58:05 +00:00
resp, err := bot.request(dst, MethodGetChatMembersCount)
if err != nil {
2018-08-21 11:05:04 +00:00
return
}
2018-08-21 11:05:04 +00:00
err = json.Unmarshal(*resp.Result, &count)
return
}