1
0
telegram/set_chat_description.go

33 lines
890 B
Go
Raw Normal View History

package telegram
import json "github.com/pquerna/ffjson/ffjson"
2018-04-19 13:02:15 +00:00
// SetChatDescriptionParameters represents data for SetChatDescription method.
type SetChatDescriptionParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
Description string `json:"description"`
}
// SetChatDescription change the description of a supergroup or a channel. The
// bot must be an administrator in the chat for this to work and must have the
// appropriate admin rights. Returns True on success.
2018-08-21 11:05:04 +00:00
func (bot *Bot) SetChatDescription(chatID int64, description string) (ok bool, err error) {
dst, err := json.Marshal(&SetChatDescriptionParameters{
ChatID: chatID,
Description: description,
})
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, MethodSetChatDescription)
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, &ok)
return
}