keyboards: added constructors

pull/292/head
dande 4 years ago
parent d7c155f97e
commit 49a392391a

@ -1365,3 +1365,7 @@ func (b *Bot) SetCommands(cmds []Command) error {
_, err := b.Raw("setMyCommands", params)
return err
}
func(b *Bot) NewMarkup() *ReplyMarkup{
return &ReplyMarkup{}
}

@ -202,6 +202,38 @@ func (r *ReplyMarkup) Reply(rows ...row) {
r.ReplyKeyboard = replyKeys
}
func(r *ReplyMarkup) Text(unique,text string) Btn {
return Btn{Unique: unique, Text: text}
}
func(r *ReplyMarkup) URL(unique,url string) Btn {
return Btn{Unique: unique, URL: url}
}
func(r *ReplyMarkup) Query(unique string, query string) Btn {
return Btn{Unique: unique, InlineQuery: query}
}
func(r *ReplyMarkup) QueryChat(unique string, query string) Btn {
return Btn{Unique: unique, InlineQueryChat: query}
}
func(r *ReplyMarkup) Login(unique,text string,login *Login) Btn {
return Btn{Unique: unique, Login: login, Text: text}
}
func(r *ReplyMarkup) Contact(text string) Btn {
return Btn{Contact:true, Text: text}
}
func(r *ReplyMarkup) Location(text string) Btn {
return Btn{Location:true, Text: text}
}
func(r *ReplyMarkup) Poll(poll PollType) Btn {
return Btn{Poll: poll}
}
// Btn is a constructor button, which will later become either a reply, or an inline button.
type Btn struct {

Loading…
Cancel
Save