From c277d8daf01693a7b333bb7dcf5be28a728ea672 Mon Sep 17 00:00:00 2001 From: Nikita Date: Sat, 5 Feb 2022 18:53:22 +0300 Subject: [PATCH] content: add protect params --- options.go | 3 +++ telebot.go | 1 + util.go | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/options.go b/options.go index 969d2a7..469083e 100644 --- a/options.go +++ b/options.go @@ -74,6 +74,9 @@ type SendOptions struct { // AllowWithoutReply allows sending messages not a as reply if the replied-to message has already been deleted. AllowWithoutReply bool + + // Protects the contents of the sent message from forwarding and saving + Protected bool } func (og *SendOptions) copy() *SendOptions { diff --git a/telebot.go b/telebot.go index 8c4f0ca..1d828fb 100644 --- a/telebot.go +++ b/telebot.go @@ -182,6 +182,7 @@ const ( EntityCode EntityType = "code" EntityCodeBlock EntityType = "pre" EntityTextLink EntityType = "text_link" + EntitySpoiler EntityType = "spoiler" ) // ChatType represents one of the possible chat types. diff --git a/util.go b/util.go index e478e13..9abd123 100644 --- a/util.go +++ b/util.go @@ -220,6 +220,10 @@ func (b *Bot) embedSendOptions(params map[string]string, opt *SendOptions) { replyMarkup, _ := json.Marshal(opt.ReplyMarkup) params["reply_markup"] = string(replyMarkup) } + + if opt.Protected { + params["protect_content"] = "true" + } } func processButtons(keys [][]InlineButton) {