hdkv
/
fwzookeeper
Archived
1
Fork 0
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues/pull-requests.
fwzookeeper/vendor/gitlab.com/toby3d/telegram/get_chat_administrators.go

30 lines
928 B
Go

package telegram
import json "github.com/pquerna/ffjson/ffjson"
// GetChatAdministratorsParameters represents data for GetChatAdministrators
// method.
type GetChatAdministratorsParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
}
// GetChatAdministrators get a list of administrators in a chat. On success,
// returns an Array of ChatMember objects that contains information about all
// chat administrators except other bots. If the chat is a group or a supergroup
// and no administrators were appointed, only the creator will be returned.
func (bot *Bot) GetChatAdministrators(chatID int64) (members []ChatMember, err error) {
dst, err := json.Marshal(&GetChatAdministratorsParameters{ChatID: chatID})
if err != nil {
return
}
resp, err := bot.request(dst, MethodGetChatAdministrators)
if err != nil {
return
}
err = json.Unmarshal(*resp.Result, &members)
return
}