handlers

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 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

This section is empty.

Types

type Container

type Container struct {
	Request      *RequestHandlers
	Telegram     *TelegramHandlers
	Notification *NotificationHandlers
}

Container holds all handler instances.

func New

func New(cfg config.Settings, log *slog.Logger, bus domain.EventBus) *Container

New creates a new handler Container instance.

func (*Container) Init

func (c *Container) Init(ctx context.Context) error

Init initializes and starts all handlers.

func (*Container) Wait

func (c *Container) Wait()

Wait blocks until all handlers have completed their work.

func (*Container) WithBot

func (c *Container) WithBot(bot telegram.Bot) *Container

WithBot sets the bot instance.

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

Init initializes the notification handlers.

func (*NotificationHandlers) WithAPI

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

WithBuilder sets the FeedBuilder instance.

func (*RequestHandlers) WithDownloader

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

Init initializes handlers.

func (*TelegramHandlers) WithBot

func (h *TelegramHandlers) WithBot(bot telegram.Bot) *TelegramHandlers

WithBot sets the telegram.Bot instance.

Jump to

Keyboard shortcuts

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