feat: added Update function to the MessageCompo.
This commit is contained in:
parent
0a6e1d4d70
commit
32ec32e8c9
4 changed files with 34 additions and 1 deletions
|
@ -184,6 +184,7 @@ WithInitFunc(func(c *tg.Context) {
|
|||
"inc-dec", tg.RenderFunc(func(c *tg.Context) tg.UI {
|
||||
var (
|
||||
kbd *tg.InlineCompo
|
||||
//cntMsg *tg.MessageCompo
|
||||
inline, std, onlyInc, onlyDec *tg.Inline
|
||||
)
|
||||
|
||||
|
@ -226,6 +227,7 @@ WithInitFunc(func(c *tg.Context) {
|
|||
inline = std
|
||||
}
|
||||
|
||||
|
||||
kbd = tg.NewMessage(
|
||||
fmt.Sprintf(format, d.Counter),
|
||||
).Inline(inline)
|
||||
|
@ -316,6 +318,9 @@ WithUsage(tg.Func(func(c *tg.Context){
|
|||
),
|
||||
)
|
||||
})),
|
||||
tg.NewCommand("invoice", "invoice check").
|
||||
WithAction(tg.Func(func(c *tg.Context){
|
||||
})),
|
||||
))
|
||||
func main() {
|
||||
log.Println(beh.Screens)
|
||||
|
|
|
@ -46,7 +46,8 @@ func (compo *InlineCompo) Update(c *Context) {
|
|||
compo.Text,
|
||||
compo.Inline.ToApi(),
|
||||
)
|
||||
c.Bot.Api.Send(edit)
|
||||
msg, _ := c.Bot.Api.Send(edit)
|
||||
compo.Message = &msg
|
||||
}
|
||||
|
||||
// Implementing the Filterer interface.
|
||||
|
|
17
tg/invoice.go
Normal file
17
tg/invoice.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package tg
|
||||
|
||||
import (
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
)
|
||||
|
||||
type InvoiceCompo struct {
|
||||
*MessageCompo
|
||||
tgbotapi.InvoiceConfig
|
||||
}
|
||||
|
||||
func (compo *InvoiceCompo) SendConfig(
|
||||
sid SessionId, bot *Bot,
|
||||
) (*SendConfig) {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -25,6 +25,16 @@ func Escape2(str string) string {
|
|||
return string(escapeRe.ReplaceAll([]byte(str), []byte("\\$1")))
|
||||
}
|
||||
|
||||
func (compo *MessageCompo) Update(c *Context) {
|
||||
edit := tgbotapi.NewEditMessageText(
|
||||
c.Session.Id.ToApi(),
|
||||
compo.Message.MessageID,
|
||||
compo.Text,
|
||||
)
|
||||
msg, _ := c.Bot.Api.Send(edit)
|
||||
compo.Message = &msg
|
||||
}
|
||||
|
||||
// Is only implemented to make it sendable and so we can put it
|
||||
// return of rendering functions.
|
||||
func (compo *MessageCompo) SetMessage(msg *Message) {
|
||||
|
|
Loading…
Reference in a new issue