service

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVQDNotFound = errors.New("could not extract vqd")
)

Functions

func ConvertOggToMP3

func ConvertOggToMP3(oggData []byte) ([]byte, error)

Types

type ChannelInfo

type ChannelInfo struct {
	ID         int64
	AccessHash int64
	Title      string
	Name       string
}

func (*ChannelInfo) GetShareID

func (c *ChannelInfo) GetShareID() string

type ChatService

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

func NewChatService

func NewChatService(db database.Database, registry *ai.ProviderRegistry, cfg *config.Config) *ChatService

func (*ChatService) GetCurrentModelForChat

func (s *ChatService) GetCurrentModelForChat(ctx context.Context, chatID int64, userID int64, name string) (*ai.ModelInfo, error)

func (*ChatService) GetCurrentModelSpec

func (s *ChatService) GetCurrentModelSpec(ctx context.Context, chatID int64) (string, error)

func (*ChatService) MergeModelParams

func (s *ChatService) MergeModelParams(chatID int64, provider, alias, prompt string, requestParams ai.ModelParams) (ai.ModelParams, error)

func (*ChatService) ResetChatModel

func (s *ChatService) ResetChatModel(ctx context.Context, chatID int64) error

func (*ChatService) SetChatModel

func (s *ChatService) SetChatModel(ctx context.Context, chatID int64, modelSpec string) error

type CurrencyService

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

func GetCurrencyService

func GetCurrencyService() *CurrencyService

func (*CurrencyService) GetUSDRate

func (s *CurrencyService) GetUSDRate(ctx context.Context, currencyCode string) (float64, error)

type DuckDuckGoSearch

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

func NewDuckDuckGoSearch

func NewDuckDuckGoSearch(client *http.Client, rateLimit time.Duration) *DuckDuckGoSearch

func (DuckDuckGoSearch) Images

func (d DuckDuckGoSearch) Images(
	keywords string,
	region string,
	safesearch string,
	timeLimit string,
	size *string,
	color *string,
	typeImage *string,
	layout *string,
	licenseImage *string,
	maxResults *int,
) ([]ImageResult, error)

func (*DuckDuckGoSearch) Text

func (d *DuckDuckGoSearch) Text(
	keywords string,
	region string,
	timeLimit string,
	maxResults int,
) ([]TextResult, error)

type ImageResult

type ImageResult struct {
	Title     string
	Image     string
	Thumbnail string
	URL       string
	Source    string
}

type Localizer

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

func NewLocalizer

func NewLocalizer(currentLang string) (*Localizer, error)

func (*Localizer) Localize

func (s *Localizer) Localize(messageID string, data map[string]any) string

type TelegramAPI

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

func GetTD

func GetTD() *TelegramAPI

func InitTDInstance

func InitTDInstance(cfg config.TelegramConfig, cache cache.Cache, logger logger.Logger) *TelegramAPI

func NewTelegramAPI

func NewTelegramAPI(apiID int, apiHash, sessionPath string, cache cache.Cache, logger logger.Logger) *TelegramAPI

func (*TelegramAPI) Auth

func (t *TelegramAPI) Auth(ctx context.Context, phone, password string, codePromptFunc auth.CodeAuthenticatorFunc) error

func (*TelegramAPI) AuthIfNeeded

func (t *TelegramAPI) AuthIfNeeded(ctx context.Context, phone, password string, codePromptFunc auth.CodeAuthenticatorFunc) error

func (*TelegramAPI) GetChannelByID

func (t *TelegramAPI) GetChannelByID(ctx context.Context, channelID int64) (*ChannelInfo, error)

func (*TelegramAPI) GetChannelPosts

func (t *TelegramAPI) GetChannelPosts(
	ctx context.Context,
	channelName string,
	since time.Time,
	limit int,
	offset int,
) ([]string, error)

GetChannelPosts retrieves messages from a channel for the specified period

func (*TelegramAPI) GetPostComments

func (t *TelegramAPI) GetPostComments(
	ctx context.Context,
	channelInput string,
	postID int,
	limit int,
) ([]string, error)

func (*TelegramAPI) ResolveChannel

func (t *TelegramAPI) ResolveChannel(ctx context.Context, channelName string) (*ChannelInfo, error)

func (*TelegramAPI) ResolveChannelInput

func (t *TelegramAPI) ResolveChannelInput(ctx context.Context, input string) (*ChannelInfo, error)

ResolveChannelInput automatically resolves channel information and cached it Supported formats: - Post URL ("https://t.me/channel/123") - Username + post ID ("channel", 123) - Channel ID + post ID (123456, 123)

type TextResult

type TextResult struct {
	Title string
	Href  string
	Body  string
}