extension

package module
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: AGPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const EnvKey = "TDL_EXTENSION"

Variables

This section is empty.

Functions

func New

func New(o Options) func(h Handler)

Types

type Config

type Config struct {
	Namespace string // tdl namespace
	DataDir   string // data directory for extension
	Proxy     string // proxy URL
	Pool      int64  // pool size
	Debug     bool   // debug mode enabled
}

type Env

type Env struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	AppID     int    `json:"app_id"`
	AppHash   string `json:"app_hash"`
	Session   []byte `json:"session"`
	DataDir   string `json:"data_dir"`
	NTP       string `json:"ntp"`
	Proxy     string `json:"proxy"`
	Pool      int64  `json:"pool"`
	Debug     bool   `json:"debug"`
}

type Extension

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

func (*Extension) Client

func (e *Extension) Client() *telegram.Client

func (*Extension) Config

func (e *Extension) Config() *Config

func (*Extension) Log

func (e *Extension) Log() *zap.Logger

func (*Extension) Name

func (e *Extension) Name() string

type Handler

type Handler func(ctx context.Context, e *Extension) error

type Options

type Options struct {
	// UpdateHandler will be passed to telegram.Client Options.
	UpdateHandler telegram.UpdateHandler
	// Middlewares will be passed to telegram.Client Options,
	// and recovery,retry,flood-wait will be used if nil.
	Middlewares []telegram.Middleware
	// Logger will be used as extension logger,
	// and default logger(write to extension data dir) will be used if nil.
	Logger *zap.Logger
}

Jump to

Keyboard shortcuts

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