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.
func (btn *Button) WithUrl(url string) *Button {
btn.Url = url
func (btn *Button) WithUrl(format string, v ...any) *Button {
btn.Url = fmt.Sprintf(format, v...)
return btn
}

View file

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

View file

@ -36,6 +36,12 @@ func (compo *MessageCompo) Update(c *Context) {
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
// return of rendering functions.
func (compo *MessageCompo) SetMessage(msg *Message) {