@@ -118,6 +118,36 @@ func (c *Client) GetInfo() (*BotInfo, error) {
118118 return info , nil
119119}
120120
121+ func (c * Client ) GetChatInfo (chatId string ) (* Chat , error ) {
122+ params := url.Values {
123+ "chatId" : {chatId },
124+ }
125+ response , err := c .Do ("/chats/getInfo" , params , nil )
126+ if err != nil {
127+ return nil , fmt .Errorf ("error while receiving information: %s" , err )
128+ }
129+
130+ chat := & Chat {}
131+ if err := json .Unmarshal (response , chat ); err != nil {
132+ return nil , fmt .Errorf ("error while unmarshalling information: %s" , err )
133+ }
134+
135+ if chat .Group != "group" {
136+ return chat , nil
137+ }
138+
139+ response , err = c .Do ("/chats/getAdmins" , params , nil )
140+ if err != nil {
141+ return nil , fmt .Errorf ("error while receiving admins: %s" , err )
142+ }
143+
144+ if err := json .Unmarshal (response , chat ); err != nil {
145+ return nil , fmt .Errorf ("error while unmarshalling admins: %s" , err )
146+ }
147+
148+ return chat , nil
149+ }
150+
121151func (c * Client ) SendMessage (message * Message ) error {
122152 params := url.Values {
123153 "chatId" : []string {message .Chat .ID },
@@ -180,7 +210,7 @@ func (c *Client) SendFile(message *Message) error {
180210 params := url.Values {
181211 "chatId" : {message .Chat .ID },
182212 "caption" : {message .Text },
183- "fileId" : {message .FileID },
213+ "fileId" : {message .FileID },
184214 }
185215
186216 response , err := c .Do ("/messages/sendFile" , params , nil )
0 commit comments