1
0
telegram/get_chat_administrators.go

30 lines
928 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
// GetChatAdministratorsParameters represents data for GetChatAdministrators
// method.
type GetChatAdministratorsParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
}
2017-10-06 07:55:54 +00:00
// 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.
2018-08-21 11:05:04 +00:00
func (bot *Bot) GetChatAdministrators(chatID int64) (members []ChatMember, err error) {
dst, err := json.Marshal(&GetChatAdministratorsParameters{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, MethodGetChatAdministrators)
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, &members)
return
}