2017-09-04 20:36:37 +00:00
|
|
|
package telegram
|
|
|
|
|
|
|
|
import (
|
2017-09-04 20:54:28 +00:00
|
|
|
"strconv"
|
|
|
|
|
2017-09-04 20:36:37 +00:00
|
|
|
json "github.com/pquerna/ffjson/ffjson"
|
|
|
|
http "github.com/valyala/fasthttp"
|
|
|
|
)
|
|
|
|
|
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.
|
2017-10-05 11:31:53 +00:00
|
|
|
func (bot *Bot) GetChatAdministrators(chatID int64) (*[]ChatMember, error) {
|
2017-09-04 20:36:37 +00:00
|
|
|
var args http.Args
|
2017-10-05 11:31:53 +00:00
|
|
|
args.Add("chat_id", strconv.FormatInt(chatID, 10))
|
2017-09-04 20:36:37 +00:00
|
|
|
|
2017-09-05 09:20:10 +00:00
|
|
|
resp, err := bot.request(nil, "getChatAdministrators", &args)
|
2017-09-04 20:36:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var data []ChatMember
|
|
|
|
err = json.Unmarshal(*resp.Result, &data)
|
|
|
|
return &data, err
|
|
|
|
}
|