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

34 lines
796 B
Go
Raw Normal View History

2018-11-29 20:32:51 +04:00
package telegram
import json "github.com/pquerna/ffjson/ffjson"
// GetChatMemberParameters represents data for GetChatMember method.
type GetChatMemberParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
// Unique identifier of the target user
UserID int `json:"user_id"`
}
// GetChatMember get information about a member of a chat. Returns a ChatMember
// object on success.
func (bot *Bot) GetChatMember(chatID int64, userID int) (member *ChatMember, err error) {
dst, err := json.Marshal(&GetChatMemberParameters{
ChatID: chatID,
UserID: userID,
})
if err != nil {
return
}
resp, err := bot.request(dst, MethodGetChatMember)
if err != nil {
return
}
member = new(ChatMember)
err = json.Unmarshal(*resp.Result, member)
return
}