diff --git a/bot.go b/bot.go index 06bc8db..e53519d 100644 --- a/bot.go +++ b/bot.go @@ -54,15 +54,16 @@ func (bot *Bot) Debug(debug bool) *Bot { func (bot *Bot) Send( sid SessionId, v Sendable, ) (*Message, error) { - ctx, ok := bot.contexts[sid] - if !ok { - return nil, ContextNotExistErr + config := v.SendConfig(sid, bot) + if config.Error != nil { + return nil, config.Error } - c := &Context{ - context: ctx, + msg, err := bot.Api.Send(config.ToApi()) + if err != nil { + return nil, err } - return c.Bot.Send(c.Session.Id, v) + return &msg, nil } // Send to the session specified its ID raw chattable from the tgbotapi. diff --git a/context.go b/context.go index 7cb2089..de11a82 100644 --- a/context.go +++ b/context.go @@ -202,6 +202,10 @@ func (c *Context) History() []Path { // Changes screen of user to the Id one. func (c *Context) Go(pth Path, args ...any) { + if pth == "" { + c.pathHistory = []Path{} + return + } var back bool if pth == "-" { ln := len(c.pathHistory)