Skip to content

Commit

Permalink
content: add protect params
Browse files Browse the repository at this point in the history
  • Loading branch information
setval committed Feb 5, 2022
1 parent 1cfc31f commit c277d8d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions telebot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c277d8d

Please sign in to comment.