Documentation
¶
Index ¶
- type Container
- type NotificationHandlers
- type RequestHandlers
- type TelegramHandlers
- func (h *TelegramHandlers) AllowedUsersMiddleware(log *slog.Logger, allowedUsers []int64) telegram.Middleware
- func (h *TelegramHandlers) ErrorsHandler(log *slog.Logger) bot.ErrorsHandler
- func (h *TelegramHandlers) Init(_ context.Context) error
- func (h *TelegramHandlers) WithBot(bot telegram.Bot) *TelegramHandlers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct {
Request *RequestHandlers
Telegram *TelegramHandlers
Notification *NotificationHandlers
}
Container holds all handler instances.
func (*Container) Wait ¶
func (c *Container) Wait()
Wait blocks until all handlers have completed their work.
func (*Container) WithBuilder ¶
func (c *Container) WithBuilder(b domain.FeedBuilder) *Container
WithBuilder sets the FeedBuilder instance.
func (*Container) WithDownloader ¶
func (c *Container) WithDownloader(d domain.EpisodeDownloader) *Container
WithDownloader sets the EpisodeDownloader instance.
type NotificationHandlers ¶
type NotificationHandlers struct {
// contains filtered or unexported fields
}
NotificationHandlers handles sending Telegram notifications for response events.
func NewNotificationHandlers ¶
func NewNotificationHandlers(log *slog.Logger, bus domain.EventBus) *NotificationHandlers
func (*NotificationHandlers) Init ¶
func (h *NotificationHandlers) Init(cxt context.Context) error
Init initializes the notification handlers.
func (*NotificationHandlers) WithAPI ¶
func (h *NotificationHandlers) WithAPI(api telegram.API) *NotificationHandlers
WithAPI sets the API for sending messages.
type RequestHandlers ¶
type RequestHandlers struct {
// contains filtered or unexported fields
}
RequestHandlers handles requests for downloading episodes and building feeds.
func NewRequestHandlers ¶
func NewRequestHandlers( cfg config.Settings, log *slog.Logger, bus domain.EventBus, ) *RequestHandlers
NewRequestHandlers creates a new RequestHandlers handler instance.
func (*RequestHandlers) Init ¶
func (h *RequestHandlers) Init(ctx context.Context) error
Init initializes event handlers and starts workers.
func (*RequestHandlers) Wait ¶
func (h *RequestHandlers) Wait()
Wait waits for all workers to finish.
func (*RequestHandlers) WithBuilder ¶
func (h *RequestHandlers) WithBuilder(b domain.FeedBuilder) *RequestHandlers
WithBuilder sets the FeedBuilder instance.
func (*RequestHandlers) WithDownloader ¶
func (h *RequestHandlers) WithDownloader(d domain.EpisodeDownloader) *RequestHandlers
WithDownloader sets the EpisodeDownloader instance.
type TelegramHandlers ¶
type TelegramHandlers struct {
// contains filtered or unexported fields
}
TelegramHandlers handles Telegram bot updates and commands.
func NewTelegramHandlers ¶
func NewTelegramHandlers(cfg config.Settings, log *slog.Logger, bus domain.EventBus) *TelegramHandlers
NewTelegramHandlers creates a new instance of TelegramHandlers.
func (*TelegramHandlers) AllowedUsersMiddleware ¶
func (h *TelegramHandlers) AllowedUsersMiddleware(log *slog.Logger, allowedUsers []int64) telegram.Middleware
AllowedUsersMiddleware is a Telegram middleware that blocks updates from users not in the allowed users list.
func (*TelegramHandlers) ErrorsHandler ¶
func (h *TelegramHandlers) ErrorsHandler(log *slog.Logger) bot.ErrorsHandler
ErrorsHandler handles errors from the Telegram bot.
func (*TelegramHandlers) Init ¶
func (h *TelegramHandlers) Init(_ context.Context) error
Init initializes handlers.
func (*TelegramHandlers) WithBot ¶
func (h *TelegramHandlers) WithBot(bot telegram.Bot) *TelegramHandlers
WithBot sets the telegram.Bot instance.