From 277c1eedbd6628260b0d41c300b014352dbb0abe Mon Sep 17 00:00:00 2001 From: Nikita Date: Sun, 23 May 2021 15:38:32 +0300 Subject: [PATCH] files: add file_name and disable content type detection fields --- file.go | 1 + options.go | 3 +++ util.go | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/file.go b/file.go index 2025e77..9d61d17 100644 --- a/file.go +++ b/file.go @@ -9,6 +9,7 @@ import ( type File struct { FileID string `json:"file_id"` UniqueID string `json:"file_unique_id"` + FileName string `json:"file_name"` FileSize int `json:"file_size"` // file on telegram server https://core.telegram.org/bots/api#file diff --git a/options.go b/options.go index 9329e70..09c30d0 100644 --- a/options.go +++ b/options.go @@ -50,6 +50,9 @@ type SendOptions struct { // ParseMode controls how client apps render your message. ParseMode ParseMode + + // DisableContentDetection abilities to disable server-side file content type detection. + DisableContentDetection bool } func (og *SendOptions) copy() *SendOptions { diff --git a/util.go b/util.go index a07020a..030da62 100644 --- a/util.go +++ b/util.go @@ -1,13 +1,13 @@ package telebot import ( + "bytes" "encoding/json" "fmt" + "github.com/pkg/errors" "log" "net/http" "strconv" - "bytes" - "github.com/pkg/errors" ) func (b *Bot) debug(err error) { @@ -195,6 +195,10 @@ func (b *Bot) embedSendOptions(params map[string]string, opt *SendOptions) { params["parse_mode"] = opt.ParseMode } + if opt.DisableContentDetection { + params["disable_content_type_detection"] = "true" + } + if opt.ReplyMarkup != nil { processButtons(opt.ReplyMarkup.InlineKeyboard) replyMarkup, _ := json.Marshal(opt.ReplyMarkup)