tg

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

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

func (*Client) API

func (c *Client) API() *tg.Client

func (*Client) Downloader

func (c *Client) Downloader() *downloader.Downloader

func (*Client) Login

func (c *Client) Login(ctx context.Context, opts LoginOptions) error

Login performs authentication (phone + code + optional 2FA). If Phone/Code are empty, prompts interactively via stdin.

func (*Client) Logout

func (c *Client) Logout(ctx context.Context) error

Logout terminates the current session on Telegram's servers and removes local session file.

func (*Client) ResolvePeer

func (c *Client) ResolvePeer(ctx context.Context, chatArg string) (tg.InputPeerClass, error)

ResolvePeer resolves a chat argument (username, phone, or numeric ID) to an InputPeer.

func (*Client) Run

func (c *Client) Run(ctx context.Context, fn func(ctx context.Context) error) error

Run executes fn inside an active Telegram connection. Authenticates if a session exists; errors if not authenticated.

func (*Client) SelfID

func (c *Client) SelfID() int64

func (*Client) Sender

func (c *Client) Sender() *message.Sender

func (*Client) Uploader

func (c *Client) Uploader() *uploader.Uploader

type LoginOptions

type LoginOptions struct {
	Phone    string
	Code     string
	Password string
}

type Options

type Options struct {
	StoreDir string
}

Jump to

Keyboard shortcuts

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