1
0
telegram/get_chat_member.go

34 lines
796 B
Go
Raw Normal View History

2017-09-04 19:47:27 +00:00
package telegram
import json "github.com/pquerna/ffjson/ffjson"
2017-09-04 19:47:27 +00:00
2018-04-19 13:02:15 +00:00
// GetChatMemberParameters represents data for GetChatMember method.
type GetChatMemberParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
2018-10-12 11:44:27 +00:00
// Unique identifier of the target user
UserID int `json:"user_id"`
}
2017-09-04 19:47:27 +00:00
2017-10-06 07:55:54 +00:00
// GetChatMember get information about a member of a chat. Returns a ChatMember
// object on success.
2018-08-21 11:05:04 +00:00
func (bot *Bot) GetChatMember(chatID int64, userID int) (member *ChatMember, err error) {
dst, err := json.Marshal(&GetChatMemberParameters{
ChatID: chatID,
UserID: userID,
})
if err != nil {
2018-08-21 11:05:04 +00:00
return
}
2017-09-04 19:47:27 +00:00
2018-04-12 11:58:05 +00:00
resp, err := bot.request(dst, MethodGetChatMember)
2017-09-04 19:47:27 +00:00
if err != nil {
2018-08-21 11:05:04 +00:00
return
2017-09-04 19:47:27 +00:00
}
2018-08-21 11:05:04 +00:00
member = new(ChatMember)
err = json.Unmarshal(*resp.Result, member)
return
2017-09-04 19:47:27 +00:00
}