all repos — telegram-bot-api @ a36af7a672af72fb2202924ab5c9001e17b76464

Golang bindings for the Telegram Bot API

add deleteChatPhoto method
Oleksandr Savchuk mrxlinch@gmail.com
Mon, 05 Mar 2018 17:12:56 +0200
commit

a36af7a672af72fb2202924ab5c9001e17b76464

parent

57be98801107f19622d22a718cdc4a5f52cc0712

2 files changed, 29 insertions(+), 0 deletions(-)

jump to
M bot.gobot.go

@@ -934,3 +934,15 @@ file := config.getFile()

return bot.UploadFile(config.method(), params, config.name(), file) } + +// DeleteChatPhoto delete photo of chat. +func (bot *BotAPI) DeleteChatPhoto(config DeleteChatPhotoConfig) (APIResponse, error) { + v, err := config.values() + if err != nil { + return APIResponse{}, err + } + + bot.debugLog(config.method(), v, nil) + + return bot.MakeRequest(config.method(), v) +}
M configs.goconfigs.go

@@ -1126,3 +1126,20 @@ // method returns Telegram API method name for sending Photo.

func (config SetChatPhotoConfig) method() string { return "setChatPhoto" } + +// DeleteChatPhotoConfig contains information for delete chat photo. +type DeleteChatPhotoConfig struct { + ChatID int64 +} + +func (config DeleteChatPhotoConfig) method() string { + return "deleteChatPhoto" +} + +func (config DeleteChatPhotoConfig) values() (url.Values, error) { + v := url.Values{} + + v.Add("chat_id", strconv.FormatInt(config.ChatID, 10)) + + return v, nil +}