app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

func New

func New(opts Options) (*App, error)

func (*App) Close

func (a *App) Close()

func (*App) DB

func (a *App) DB() *store.DB

func (*App) DownloadMedia

func (a *App) DownloadMedia(ctx context.Context, chatArg string, msgID int, outputDir string) (string, error)

DownloadMedia downloads media from a specific message.

func (*App) ExportChat

func (a *App) ExportChat(ctx context.Context, chatArg string, w io.Writer, fromDB bool) error

ExportChat exports messages from a chat to a writer as JSON.

func (*App) ListChats

func (a *App) ListChats(ctx context.Context, chatType string, limit int) ([]store.Chat, error)

ListChats fetches dialogs from Telegram and returns them.

func (*App) ListMessages

func (a *App) ListMessages(ctx context.Context, chatArg string, limit int) ([]store.Message, error)

ListMessages fetches message history from Telegram.

func (*App) Login

func (a *App) Login(ctx context.Context, phone, code, password string) error

Login authenticates with Telegram.

func (*App) Logout

func (a *App) Logout(ctx context.Context) error

func (*App) MessageContext

func (a *App) MessageContext(ctx context.Context, chatArg string, msgID, before, after int) ([]store.Message, error)

MessageContext returns messages around a specific message.

func (*App) RunTG

func (a *App) RunTG(ctx context.Context, fn func(ctx context.Context) error) error

RunTG runs a function inside the Telegram client session.

func (*App) SendFile

func (a *App) SendFile(ctx context.Context, chatArg, filePath, caption string) error

SendFile sends a file to the given chat.

func (*App) SendText

func (a *App) SendText(ctx context.Context, chatArg, message string) error

SendText sends a text message to the given chat.

func (*App) StoreDir

func (a *App) StoreDir() string

func (*App) SyncAllChats

func (a *App) SyncAllChats(ctx context.Context, msgsPerChat int, onProgress func(chatName string, fetched int)) error

SyncAllChats syncs all dialogs and their recent messages.

func (*App) SyncChat

func (a *App) SyncChat(ctx context.Context, chatArg string, onProgress func(fetched int)) error

SyncChat syncs message history for a specific chat to local DB.

func (*App) TG

func (a *App) TG() *tgclient.Client

type Options

type Options struct {
	StoreDir string
	JSON     bool
}

Jump to

Keyboard shortcuts

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