feat: ...

This commit is contained in:
Andrey Parhomenko 2023-12-12 23:47:32 +03:00
parent 97b1bec13b
commit ae2da1201c
3 changed files with 9 additions and 4 deletions

View file

@ -49,8 +49,8 @@ func (btn *Button) Rand() *Button {
} }
// Set the URL for the button. Only for inline buttons. // Set the URL for the button. Only for inline buttons.
func (btn *Button) WithUrl(url string) *Button { func (btn *Button) WithUrl(format string, v ...any) *Button {
btn.Url = url btn.Url = fmt.Sprintf(format, v...)
return btn return btn
} }

View file

@ -49,8 +49,7 @@ func (compo *InlineCompo) Update(c *Context) {
var edit tgbotapi.Chattable var edit tgbotapi.Chattable
markup := compo.Inline.ToApi() markup := compo.Inline.ToApi()
ln := len(markup.InlineKeyboard) ln := len(markup.InlineKeyboard)
c.Sendf("%d shit", ln) if ln == 0 || compo.Inline.Rows == nil {
if ln == 0 {
edit = tgbotapi.NewEditMessageText( edit = tgbotapi.NewEditMessageText(
c.Session.Id.ToApi(), c.Session.Id.ToApi(),
compo.Message.MessageID, compo.Message.MessageID,

View file

@ -36,6 +36,12 @@ func (compo *MessageCompo) Update(c *Context) {
compo.Message = &msg compo.Message = &msg
} }
func (compo *MessageCompo) Delete(c *Context) {
cfg := tgbotapi.NewDeleteMessage(c.Session.Id.ToApi(), compo.Message.MessageID)
c.Bot.Api.Send(cfg)
//c.Sendf("%q", err)
}
// Is only implemented to make it sendable and so we can put it // Is only implemented to make it sendable and so we can put it
// return of rendering functions. // return of rendering functions.
func (compo *MessageCompo) SetMessage(msg *Message) { func (compo *MessageCompo) SetMessage(msg *Message) {