session

package
v0.0.0-...-0648364 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TdesktopApiID   = 2040
	TdesktopApiHash = "b18441a1ff607e10a989891a5462e627"
)

Variables

View Source
var (
	CodeRequiredError = errors.New("code is required")
)

Functions

func Connect

func Connect(f func(ctx context.Context, client *telegram.Client, dispatcher tg.UpdateDispatcher, options telegram.Options) error, device telegram.DeviceConfig, apiID int, apiHash string, sessionString string, proxy string, flow auth.Flow) error

func ConvertSQLiteSessionToTelethonStringSession

func ConvertSQLiteSessionToTelethonStringSession(
	sessionPath string,
) (string, error)

func ConvertTDATAToTelethonStringSession

func ConvertTDATAToTelethonStringSession(dirname string) (string, error)

func DeleteProfilePictures

func DeleteProfilePictures(ctx context.Context, client *telegram.Client) error

DeleteProfilePictures delete all current user profile picture.

func EncodeSessionToTelethonString

func EncodeSessionToTelethonString(sessionData *session.Data) (string, error)

func GetNewDefaultAuthConversator

func GetNewDefaultAuthConversator(phone string, password string) auth.Flow

func GetSessionString

func GetSessionString(dc int, addr string, port int, authkey []byte) (string, error)

func SetProfilePicture

func SetProfilePicture(ctx context.Context, client *telegram.Client, file tg.InputFileClass) error

SetProfilePicture sets the current user profile picture. Use the `Uploader` struct in `github.com/gotd/td/telegram/uploader`

func UpdateProfile

func UpdateProfile(
	ctx context.Context,
	client *telegram.Client,
	username string,
	firstName string,
	lastName string,
	description string,
) error

UpdateProfile updates common elements of the current user profile, like its username, first name, last name, and description.

func Windows

func Windows() telegram.DeviceConfig

Types

type DefaultAuthConversator

type DefaultAuthConversator struct {
	PhoneNumber string
	Passwd      string
}

func (DefaultAuthConversator) AcceptTermsOfService

func (DefaultAuthConversator) AcceptTermsOfService(ctx context.Context, tos tg.HelpTermsOfService) error

func (DefaultAuthConversator) Code

func (k DefaultAuthConversator) Code(ctx context.Context, sentCode *tg.AuthSentCode) (string, error)

func (DefaultAuthConversator) Password

func (k DefaultAuthConversator) Password(ctx context.Context) (string, error)

func (DefaultAuthConversator) Phone

func (DefaultAuthConversator) SignUp

type Device

type Device struct {
	SystemVersion  string `json:"system_version"`
	LangPack       string `json:"lang_pack"`
	DeviceModel    string `json:"device_model"`
	AppVersion     string `json:"app_version"`
	LangCode       string `json:"lang_code"`
	SystemLangCode string `json:"system_lang_code"`
}

type Devices

type Devices struct {
	Tdesktop struct {
		ApiID          int      `json:"api_id"`
		ApiHash        string   `json:"api_hash"`
		SystemVersions []string `json:"system_versions"`
		LangPack       string   `json:"lang_pack"`
		DeviceModels   []string `json:"device_models"`
		AppVersion     string   `json:"app_version"`
		LangCode       string   `json:"lang_code"`
		SystemLangCode string   `json:"system_lang_code"`
	} `json:"tdesktop"`
}

type MemorySession

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

MemorySession implements in-memory session storage. Goroutine-safe.

func (*MemorySession) LoadSession

func (s *MemorySession) LoadSession(context.Context) ([]byte, error)

LoadSession loads session from memory.

func (*MemorySession) StoreSession

func (s *MemorySession) StoreSession(ctx context.Context, data []byte) error

StoreSession stores session to memory.

type SQLiteSession

type SQLiteSession struct {
	DC        int           `db:"dc_id"`
	Addr      string        `db:"server_address"`
	Port      int           `db:"port"`
	AuthKey   []byte        `db:"auth_key"`
	TakeoutID sql.NullInt32 `db:"takeout_id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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