Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is tgbotapi.NewEditMessageMedia? #529

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,17 @@ func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKe
}
}

// NewEditMessageMedia allows you to edit message media.
func NewEditMessageMedia(chatID int64, messageID int, media interface{}) EditMessageMediaConfig {
return EditMessageMediaConfig{
BaseEdit: BaseEdit{
ChatID: chatID,
MessageID: messageID,
},
Media: media,
}
}

// NewRemoveKeyboard hides the keyboard, with the option for being selective
// or hiding for everyone.
func NewRemoveKeyboard(selective bool) ReplyKeyboardRemove {
Expand Down
10 changes: 10 additions & 0 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ func TestNewEditMessageReplyMarkup(t *testing.T) {

}

func TestNewEditMessageMedia(t *testing.T) {
edit := NewEditMessageMedia(ChatID, ReplyToMessageID, "new media")

if value, ok := edit.Media.(string); !ok || value != "new media" ||
edit.BaseEdit.ChatID != ChatID ||
edit.BaseEdit.MessageID != ReplyToMessageID {
t.Fail()
}
}

func TestNewDice(t *testing.T) {
dice := NewDice(42)

Expand Down