telebotutils

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context added in v1.0.2

func Context(c tele.Context) context.Context

Context returns the update context installed by WithContext. It panics if the handler is running without that middleware.

func IsClientError added in v1.0.2

func IsClientError(err error) bool

IsClientError reports whether err wraps an error created by NewClientError.

func LogOnErr

func LogOnErr(parent context.Context) func(error, tele.Context)

LogOnErr returns a Telebot error handler that logs with the update context when available. It uses parent for errors reported outside a handler.

func ReportOnErr

func ReportOnErr(parent context.Context) func(error, tele.Context)

ReportOnErr returns a Telebot error handler that logs the error and replies in the update's chat. Client errors expose their message and other errors receive a generic reply.

func WithContext added in v1.0.2

func WithContext(parent context.Context) tele.MiddlewareFunc

WithContext derives an update context from parent and adds the update ID to its logger.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error wraps a handler error with an HTTP status code for error reporting.

func NewClientError

func NewClientError(err error) Error

NewClientError wraps an error whose message may be shown to the user.

func NewServerError

func NewServerError(err error) Error

NewServerError wraps an internal error reported with a generic reply.

func (Error) Error

func (e Error) Error() string

Error renders the code and the wrapped error.

func (Error) Unwrap added in v1.0.2

func (e Error) Unwrap() error

Unwrap returns the wrapped error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL