Documentation
¶
Index ¶
- Variables
- func AddOutputFlags(cmd *cobra.Command)
- func Execute() int
- func ExecuteRoot(root *cobra.Command) int
- func GetMsgRunner(_ context.Context, dbPath, selector string, messageID int64, ...) (any, error)
- func ListMsgsRunner(_ context.Context, dbPath, selector string, since, until string, limit int, ...) (any, error)
- func MeLiveRunner(ctx context.Context, dbPath, sessionPath string) (any, error)
- func MeOfflineRunner(_ context.Context, dbPath, sessionPath string) (any, error)
- func NewRootCommand() *cobra.Command
- func RegisterAll(root *cobra.Command, mgr *accounts.Manager, cfg CommandsConfig)
- func SearchRunner(_ context.Context, dbPath, selector, query string, caseSensitive bool, ...) (any, error)
- func ShowRunner(_ context.Context, dbPath, selector string, limit int, ...) (any, error)
- type AuthPathProvider
- type ChatRef
- type ClientFactory
- type CommandsConfig
- type FullMessageDTO
- type MessageSummaryDTO
- type RootConfig
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is the build version string. Set via -ldflags at release time.
Functions ¶
func AddOutputFlags ¶
func ExecuteRoot ¶
func GetMsgRunner ¶
func GetMsgRunner(_ context.Context, dbPath, selector string, messageID int64, includeDeleted bool) (any, error)
GetMsgRunner mirrors Python `_get_runner`.
func ListMsgsRunner ¶
func ListMsgsRunner(_ context.Context, dbPath, selector string, since, until string, limit int, reverse, includeDeleted bool) (any, error)
ListMsgsRunner mirrors Python `_list_runner`.
func MeLiveRunner ¶
MeLiveRunner connects to Telegram via gotd and refreshes tg_me.
func MeOfflineRunner ¶
MeOfflineRunner returns the cached self-user envelope data, or *resolve.NotFound when the cache is empty. Connecting and closing the DB is the runner's responsibility so the dispatch chokepoint stays uniform.
func NewRootCommand ¶
func RegisterAll ¶
func RegisterAll(root *cobra.Command, mgr *accounts.Manager, cfg CommandsConfig)
RegisterAll wires every command group onto root. The accounts manager is the source of truth for per-account paths and also receives accounts-* subcommand calls.
Types ¶
type AuthPathProvider ¶
AuthPathProvider lets tests inject account paths without depending on the real filesystem layout. Phase 15 will provide the production implementation.
type ClientFactory ¶
ClientFactory builds a per-command Telegram client. Production wires this to gotd/td; tests inject a *client.FakeClient. The factory receives both the session path (gotd auth state) and the per-account DB path (so the gotd client can read tg_entities to turn chat_ids into InputPeers).
type CommandsConfig ¶
type CommandsConfig struct {
Paths AuthPathProvider
ClientFactory ClientFactory
}
CommandsConfig bundles dependencies the command tree needs.
type FullMessageDTO ¶
type FullMessageDTO struct {
ChatID int64 `json:"chat_id"`
MessageID int64 `json:"message_id"`
SenderID *int64 `json:"sender_id"`
Date string `json:"date"`
Text *string `json:"text"`
IsOutgoing bool `json:"is_outgoing"`
ReplyToMsgID *int64 `json:"reply_to_msg_id"`
HasMedia bool `json:"has_media"`
MediaType *string `json:"media_type"`
MediaPath *string `json:"media_path"`
RawJSON any `json:"raw_json"`
}
FullMessageDTO mirrors Python `_full_message`.
type MessageSummaryDTO ¶
type MessageSummaryDTO struct {
MessageID int64 `json:"message_id"`
Date string `json:"date"`
IsOutgoing bool `json:"is_outgoing"`
Text *string `json:"text"`
MediaType *string `json:"media_type"`
}
MessageSummaryDTO is the wire shape mirroring Python `_message_summary`.
type RootConfig ¶
type RootConfig struct {
ReadOnly bool
LockWaitSeconds float64
Full bool
Account string
// ExitCode is set by command runners that emit their own envelope so the
// process exit matches the dispatch classification rather than cobra's
// default exit-1-on-RunE-error.
ExitCode int
}
func RootConfigFrom ¶
func RootConfigFrom(cmd *cobra.Command) RootConfig