Skip to content

Commit

Permalink
Merge pull request tucnak#485 from setval/support-5.6
Browse files Browse the repository at this point in the history
api: support 5.6
  • Loading branch information
demget authored Feb 5, 2022
2 parents 0fd6dea + 496146d commit 9849ae0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const (
// AllowWithoutReply = SendOptions.AllowWithoutReply
AllowWithoutReply

// Protected = SendOptions.Protected
Protected

// ForceReply = ReplyMarkup.ForceReply
ForceReply

Expand Down Expand Up @@ -74,6 +77,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
6 changes: 6 additions & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ func extractOptions(how []interface{}) *SendOptions {
opts.ReplyMarkup = &ReplyMarkup{}
}
opts.ReplyMarkup.RemoveKeyboard = true
case Protected:
opts.Protected = true
default:
panic("telebot: unsupported flag-option")
}
Expand Down Expand Up @@ -220,6 +222,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 9849ae0

Please sign in to comment.