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/set_chat_description.go

34 lines
933 B
Go
Raw Normal View History

2018-12-22 17:38:56 +04:00
package telegram
import json "github.com/pquerna/ffjson/ffjson"
// SetChatDescriptionParameters represents data for SetChatDescription method.
type SetChatDescriptionParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
// New chat description, 0-255 characters
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.
func (bot *Bot) SetChatDescription(chatID int64, description string) (ok bool, err error) {
dst, err := json.Marshal(&SetChatDescriptionParameters{
ChatID: chatID,
Description: description,
})
if err != nil {
return
}
resp, err := bot.request(dst, MethodSetChatDescription)
if err != nil {
return
}
err = json.Unmarshal(*resp.Result, &ok)
return
}