2018-02-14 21:52:52 +00:00
|
|
|
package telegram
|
|
|
|
|
2018-02-15 23:28:49 +00:00
|
|
|
import json "github.com/pquerna/ffjson/ffjson"
|
2018-02-14 21:52:52 +00:00
|
|
|
|
2018-04-19 13:02:15 +00:00
|
|
|
// SetChatDescriptionParameters represents data for SetChatDescription method.
|
2018-02-15 23:28:49 +00:00
|
|
|
type SetChatDescriptionParameters struct {
|
|
|
|
// Unique identifier for the target chat
|
|
|
|
ChatID int64 `json:"chat_id"`
|
|
|
|
|
|
|
|
Description string `json:"description"`
|
|
|
|
}
|
2018-02-14 21:52:52 +00:00
|
|
|
|
|
|
|
// 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.
|
|
|
|
func (bot *Bot) SetChatDescription(chatID int64, description string) (bool, error) {
|
2018-02-15 23:28:49 +00:00
|
|
|
dst, err := json.Marshal(&SetChatDescriptionParameters{
|
|
|
|
ChatID: chatID,
|
|
|
|
Description: description,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return false, err
|
|
|
|
}
|
2018-02-14 21:52:52 +00:00
|
|
|
|
2018-04-12 11:58:05 +00:00
|
|
|
resp, err := bot.request(dst, MethodSetChatDescription)
|
2018-02-14 21:52:52 +00:00
|
|
|
if err != nil {
|
|
|
|
return false, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var data bool
|
|
|
|
err = json.Unmarshal(*resp.Result, &data)
|
|
|
|
return data, err
|
|
|
|
}
|