|
|
|
@ -3,6 +3,7 @@ package telebot
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
|
)
|
|
|
|
@ -123,6 +124,11 @@ type Context interface {
|
|
|
|
|
// See Delete from bot.go.
|
|
|
|
|
Delete() error
|
|
|
|
|
|
|
|
|
|
// DeleteAfter waits for the duration to elapse and then removes the
|
|
|
|
|
// message. It handles an error automatically using b.OnError callback.
|
|
|
|
|
// It returns a Timer that can be used to cancel the call using its Stop method.
|
|
|
|
|
DeleteAfter(d time.Duration) *time.Timer
|
|
|
|
|
|
|
|
|
|
// Notify updates the chat action for the current recipient.
|
|
|
|
|
// See Notify from bot.go.
|
|
|
|
|
Notify(action ChatAction) error
|
|
|
|
@ -445,6 +451,14 @@ func (c *nativeContext) Delete() error {
|
|
|
|
|
return c.b.Delete(msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *nativeContext) DeleteAfter(d time.Duration) *time.Timer {
|
|
|
|
|
return time.AfterFunc(d, func() {
|
|
|
|
|
if err := c.Delete(); err != nil {
|
|
|
|
|
c.b.OnError(err, c)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *nativeContext) Notify(action ChatAction) error {
|
|
|
|
|
return c.b.Notify(c.Recipient(), action)
|
|
|
|
|
}
|
|
|
|
|