Skip to content

Commit

Permalink
Added WebAppInfo utility
Browse files Browse the repository at this point in the history
  • Loading branch information
mymmrac committed Nov 15, 2023
1 parent 0fecf05 commit a4aa6e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions telegoutil/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ func ReplyKeyboardRemove() *telego.ReplyKeyboardRemove {
}
}

// WebAppInfo creates telego.WebAppInfo with required fields
func WebAppInfo(url string) *telego.WebAppInfo {
return &telego.WebAppInfo{
URL: url,
}
}

// ForceReply creates telego.ForceReply with required fields
func ForceReply() *telego.ForceReply {
return &telego.ForceReply{
Expand Down
5 changes: 5 additions & 0 deletions telegoutil/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ func TestReplyKeyboardRemove(t *testing.T) {
assert.True(t, r.RemoveKeyboard)
}

func TestWebAppInfo(t *testing.T) {
w := WebAppInfo(text1)
assert.Equal(t, text1, w.URL)
}

func TestForceReply(t *testing.T) {
f := ForceReply()
assert.True(t, f.ForceReply)
Expand Down

0 comments on commit a4aa6e6

Please sign in to comment.