Documentation
¶
Overview ¶
Package botcontext provides a mechanism to embed and retrieve bot-specific context (Client, EventEmitter, Logger) within a standard context.Context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBotContext ¶
func WithBotContext(ctx context.Context, bot BotContext) context.Context
WithBotContext returns a new context with the BotContext embedded.
Types ¶
type BotContext ¶
type BotContext interface {
Client() client.ClientWithResponsesInterface
EventEmitter() eventemitter.EventEmitter
Logger() logger.Logger
}
BotContext provides access to bot capabilities without coupling to internals. It is embedded in context.Context and passed to handlers.
func FromContext ¶
func FromContext(ctx context.Context) BotContext
FromContext retrieves the BotContext from the context. It returns nil if the BotContext is not found.
Click to show internal directories.
Click to hide internal directories.