builtin

package
v0.0.0-...-14802c6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminPlugin

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

AdminPlugin provides owner-only system commands.

func NewAdmin

func NewAdmin() *AdminPlugin

func (*AdminPlugin) Description

func (p *AdminPlugin) Description() string

func (*AdminPlugin) Init

func (p *AdminPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*AdminPlugin) Name

func (p *AdminPlugin) Name() string

func (*AdminPlugin) Start

func (p *AdminPlugin) Start(_ context.Context) error

func (*AdminPlugin) Stop

func (p *AdminPlugin) Stop(_ context.Context) error

type AliasPlugin

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

AliasPlugin manages command aliases with persistent storage.

func NewAlias

func NewAlias() *AliasPlugin

func (*AliasPlugin) Description

func (p *AliasPlugin) Description() string

func (*AliasPlugin) Init

func (p *AliasPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*AliasPlugin) Name

func (p *AliasPlugin) Name() string

func (*AliasPlugin) Start

func (p *AliasPlugin) Start(_ context.Context) error

func (*AliasPlugin) Stop

func (p *AliasPlugin) Stop(_ context.Context) error

type AutofixPlugin

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

AutofixPlugin provides one-click fix: git sync + restart. Inspired by TeleBox's autofix plugin.

func NewAutofix

func NewAutofix() *AutofixPlugin

func (*AutofixPlugin) Description

func (p *AutofixPlugin) Description() string

func (*AutofixPlugin) Init

func (p *AutofixPlugin) Init(ctx context.Context, mgr plugin.Manager) error

func (*AutofixPlugin) Name

func (p *AutofixPlugin) Name() string

func (*AutofixPlugin) Start

func (p *AutofixPlugin) Start(ctx context.Context) error

func (*AutofixPlugin) Stop

func (p *AutofixPlugin) Stop(ctx context.Context) error

type BFPlugin

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

BFPlugin provides backup and restore functionality.

func NewBF

func NewBF() *BFPlugin

func (*BFPlugin) Description

func (p *BFPlugin) Description() string

func (*BFPlugin) Init

func (p *BFPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*BFPlugin) Name

func (p *BFPlugin) Name() string

func (*BFPlugin) Start

func (p *BFPlugin) Start(_ context.Context) error

func (*BFPlugin) Stop

func (p *BFPlugin) Stop(_ context.Context) error

type CorePlugin

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

CorePlugin provides fundamental startup/shutdown commands. This is the minimal core — help, status, ppm are separate plugins.

func NewCore

func NewCore(version string) *CorePlugin

func (*CorePlugin) Description

func (p *CorePlugin) Description() string

func (*CorePlugin) Init

func (p *CorePlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*CorePlugin) Name

func (p *CorePlugin) Name() string

func (*CorePlugin) Start

func (p *CorePlugin) Start(_ context.Context) error

func (*CorePlugin) Stop

func (p *CorePlugin) Stop(_ context.Context) error

type CronPlugin

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

CronPlugin provides cron management commands.

func NewCron

func NewCron(cronMgr *cron.Manager) *CronPlugin

func (*CronPlugin) Description

func (p *CronPlugin) Description() string

func (*CronPlugin) Init

func (p *CronPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*CronPlugin) Name

func (p *CronPlugin) Name() string

func (*CronPlugin) Start

func (p *CronPlugin) Start(_ context.Context) error

func (*CronPlugin) Stop

func (p *CronPlugin) Stop(_ context.Context) error

type DebugPlugin

type DebugPlugin struct{}

DebugPlugin provides debugging and profiling commands.

func NewDebug

func NewDebug() *DebugPlugin

func (*DebugPlugin) Description

func (p *DebugPlugin) Description() string

func (*DebugPlugin) Init

func (p *DebugPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*DebugPlugin) Name

func (p *DebugPlugin) Name() string

func (*DebugPlugin) Start

func (p *DebugPlugin) Start(_ context.Context) error

func (*DebugPlugin) Stop

func (p *DebugPlugin) Stop(_ context.Context) error

type ExecPlugin

type ExecPlugin struct{}

ExecPlugin executes system commands (owner only).

func NewExec

func NewExec() *ExecPlugin

func (*ExecPlugin) Description

func (p *ExecPlugin) Description() string

func (*ExecPlugin) Init

func (p *ExecPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*ExecPlugin) Name

func (p *ExecPlugin) Name() string

func (*ExecPlugin) Start

func (p *ExecPlugin) Start(_ context.Context) error

func (*ExecPlugin) Stop

func (p *ExecPlugin) Stop(_ context.Context) error

type FunPlugin

type FunPlugin struct{}

FunPlugin provides entertainment commands.

func NewFun

func NewFun() *FunPlugin

func (*FunPlugin) Description

func (p *FunPlugin) Description() string

func (*FunPlugin) Init

func (p *FunPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*FunPlugin) Name

func (p *FunPlugin) Name() string

func (*FunPlugin) Start

func (p *FunPlugin) Start(_ context.Context) error

func (*FunPlugin) Stop

func (p *FunPlugin) Stop(_ context.Context) error

type GrowthStatus

type GrowthStatus struct {
	HeapGrowth         *float64
	RSSGrowth          *float64
	HeapGrowthExceeded bool
	RSSGrowthExceeded  bool
}

type HealthConfig

type HealthConfig struct {
	Enabled             bool    `json:"enabled"`
	MemoryThresholdMB   float64 `json:"memory_threshold_mb"` // Heap threshold
	RSSThresholdMB      float64 `json:"rss_threshold_mb"`    // RSS threshold
	GrowthThresholdMB   float64 `json:"growth_threshold_mb"` // Growth from baseline
	BaselineHeapMB      float64 `json:"baseline_heap_mb"`    // Baseline heap
	BaselineRSSMB       float64 `json:"baseline_rss_mb"`     // Baseline RSS
	BaselineMode        string  `json:"baseline_mode"`       // "on-enable", "manual", "on-reload"
	SilentEnabled       bool    `json:"silent_enabled"`      // Silent notifications
	SoftStreak          int     `json:"soft_streak"`         // Consecutive samples before GC/reload
	HardStreak          int     `json:"hard_streak"`         // Consecutive samples before restart
	ActionCooldownMin   int     `json:"action_cooldown_min"` // Cooldown between actions (minutes)
	BusyDeferMaxMin     int     `json:"busy_defer_max_min"`  // Max defer when busy (minutes)
	LastActionAt        int64   `json:"last_action_at"`      // Unix timestamp
	OverThresholdStreak int     `json:"-"`                   // Runtime state
	BusyDeferSince      int64   `json:"-"`                   // Runtime state
	LastGcAt            int64   `json:"-"`                   // Runtime state
	LastSample          MemInfo `json:"-"`                   // Runtime state
}

type HealthPlugin

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

HealthPlugin provides memory monitoring with auto GC/reload/restart. Inspired by TeleBox's Health plugin but implemented in Go.

func NewHealth

func NewHealth() *HealthPlugin

func (*HealthPlugin) Description

func (p *HealthPlugin) Description() string

func (*HealthPlugin) Init

func (p *HealthPlugin) Init(ctx context.Context, mgr plugin.Manager) error

func (*HealthPlugin) Name

func (p *HealthPlugin) Name() string

func (*HealthPlugin) Start

func (p *HealthPlugin) Start(ctx context.Context) error

func (*HealthPlugin) Stop

func (p *HealthPlugin) Stop(ctx context.Context) error

type HelpPlugin

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

HelpPlugin provides help and command discovery. This is the primary user-facing help system and MUST be built-in.

func NewHelp

func NewHelp() *HelpPlugin

func (*HelpPlugin) Description

func (p *HelpPlugin) Description() string

func (*HelpPlugin) Init

func (p *HelpPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*HelpPlugin) Name

func (p *HelpPlugin) Name() string

func (*HelpPlugin) Start

func (p *HelpPlugin) Start(_ context.Context) error

func (*HelpPlugin) Stop

func (p *HelpPlugin) Stop(_ context.Context) error

type InfoPlugin

type InfoPlugin struct{}

InfoPlugin shows user/chat info.

func NewInfo

func NewInfo() *InfoPlugin

func (*InfoPlugin) Description

func (p *InfoPlugin) Description() string

func (*InfoPlugin) Init

func (p *InfoPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*InfoPlugin) Name

func (p *InfoPlugin) Name() string

func (*InfoPlugin) Start

func (p *InfoPlugin) Start(_ context.Context) error

func (*InfoPlugin) Stop

func (p *InfoPlugin) Stop(_ context.Context) error

type KittPlugin

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

KittPlugin provides advanced trigger system (match -> execute). Inspired by TeleBox's Kitt plugin but implemented in Go.

func NewKitt

func NewKitt() *KittPlugin

func (*KittPlugin) Description

func (p *KittPlugin) Description() string

func (*KittPlugin) Init

func (p *KittPlugin) Init(ctx context.Context, mgr plugin.Manager) error

func (*KittPlugin) Name

func (p *KittPlugin) Name() string

func (*KittPlugin) Start

func (p *KittPlugin) Start(ctx context.Context) error

func (*KittPlugin) Stop

func (p *KittPlugin) Stop(ctx context.Context) error

type KittTask

type KittTask struct {
	ID      string `json:"id"`
	Remark  string `json:"remark,omitempty"`
	Match   string `json:"match"`
	Action  string `json:"action"`
	Enabled bool   `json:"enabled"`
}

type LeechDB

type LeechDB struct {
	Jobs     []LeechJob     `json:"jobs"`
	Messages []LeechMessage `json:"messages"`
}

type LeechJob

type LeechJob struct {
	ID            string     `json:"id"`
	Target        string     `json:"target"`
	ChatTitle     string     `json:"chat_title"`
	ChatType      string     `json:"chat_type"`
	FromDate      time.Time  `json:"from_date"`
	ToDate        time.Time  `json:"to_date"`
	BatchSize     int        `json:"batch_size"`
	Limit         int        `json:"limit"`
	Status        string     `json:"status"` // running, completed, failed, stopped
	SavedCount    int        `json:"saved_count"`
	ScannedCount  int        `json:"scanned_count"`
	StoppedReason string     `json:"stopped_reason,omitempty"`
	StartedAt     time.Time  `json:"started_at"`
	CompletedAt   *time.Time `json:"completed_at,omitempty"`
}

type LeechMessage

type LeechMessage struct {
	JobID         string    `json:"job_id"`
	MessageID     int64     `json:"message_id"`
	ChatID        string    `json:"chat_id"`
	SenderID      string    `json:"sender_id"`
	Text          string    `json:"text"`
	Date          time.Time `json:"date"`
	HasMedia      bool      `json:"has_media"`
	MediaType     string    `json:"media_type,omitempty"`
	MediaFilePath string    `json:"media_file_path,omitempty"`
}

type LeechPlugin

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

LeechPlugin archives messages from chats/groups/channels to local SQLite. Inspired by TeleBox's leech plugin.

func NewLeech

func NewLeech() *LeechPlugin

func (*LeechPlugin) Description

func (p *LeechPlugin) Description() string

func (*LeechPlugin) Init

func (p *LeechPlugin) Init(ctx context.Context, mgr plugin.Manager) error

func (*LeechPlugin) Name

func (p *LeechPlugin) Name() string

func (*LeechPlugin) Start

func (p *LeechPlugin) Start(ctx context.Context) error

func (*LeechPlugin) Stop

func (p *LeechPlugin) Stop(ctx context.Context) error

type LogLevelPlugin

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

LogLevelPlugin provides runtime log level changes. Inspired by TeleBox's loglevel plugin.

func NewLogLevel

func NewLogLevel() *LogLevelPlugin

func (*LogLevelPlugin) Description

func (p *LogLevelPlugin) Description() string

func (*LogLevelPlugin) Init

func (p *LogLevelPlugin) Init(ctx context.Context, mgr plugin.Manager) error

func (*LogLevelPlugin) Name

func (p *LogLevelPlugin) Name() string

func (*LogLevelPlugin) Start

func (p *LogLevelPlugin) Start(ctx context.Context) error

func (*LogLevelPlugin) Stop

func (p *LogLevelPlugin) Stop(ctx context.Context) error

type LogPlugin

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

LogPlugin provides log viewing and management commands.

func NewLog

func NewLog() *LogPlugin

func (*LogPlugin) AddEntry

func (p *LogPlugin) AddEntry(level, msg string)

AddEntry adds a log entry (for integration with logger)

func (*LogPlugin) Description

func (p *LogPlugin) Description() string

func (*LogPlugin) Init

func (p *LogPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*LogPlugin) Name

func (p *LogPlugin) Name() string

func (*LogPlugin) Start

func (p *LogPlugin) Start(_ context.Context) error

func (*LogPlugin) Stop

func (p *LogPlugin) Stop(_ context.Context) error

type MemInfo

type MemInfo struct {
	HeapUsed  float64 `json:"heap_used_mb"`
	HeapTotal float64 `json:"heap_total_mb"`
	RSS       float64 `json:"rss_mb"`
	External  float64 `json:"external_mb"`
	Arrays    float64 `json:"arrays_mb"`
}

type NotePlugin

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

NotePlugin provides simple notes.

func NewNote

func NewNote() *NotePlugin

func (*NotePlugin) Description

func (p *NotePlugin) Description() string

func (*NotePlugin) Init

func (p *NotePlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*NotePlugin) Name

func (p *NotePlugin) Name() string

func (*NotePlugin) Start

func (p *NotePlugin) Start(_ context.Context) error

func (*NotePlugin) Stop

func (p *NotePlugin) Stop(_ context.Context) error

type PPMPlugin

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

PPMPlugin — Plugin Package Manager. Full lifecycle: search, install, remove, load, unload, reload, list, info.

func NewPPM

func NewPPM(pluginLoader *loader.Loader) *PPMPlugin

func (*PPMPlugin) Description

func (p *PPMPlugin) Description() string

func (*PPMPlugin) Init

func (p *PPMPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*PPMPlugin) Name

func (p *PPMPlugin) Name() string

func (*PPMPlugin) Start

func (p *PPMPlugin) Start(_ context.Context) error

func (*PPMPlugin) Stop

func (p *PPMPlugin) Stop(_ context.Context) error

type PrefixPlugin

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

PrefixPlugin manages command prefixes with persistent storage.

func NewPrefix

func NewPrefix() *PrefixPlugin

func (*PrefixPlugin) Description

func (p *PrefixPlugin) Description() string

func (*PrefixPlugin) Init

func (p *PrefixPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*PrefixPlugin) Name

func (p *PrefixPlugin) Name() string

func (*PrefixPlugin) Start

func (p *PrefixPlugin) Start(_ context.Context) error

func (*PrefixPlugin) Stop

func (p *PrefixPlugin) Stop(_ context.Context) error

type RePlugin

type RePlugin struct{}

RePlugin repeats messages (复读机).

func NewRe

func NewRe() *RePlugin

func (*RePlugin) Description

func (p *RePlugin) Description() string

func (*RePlugin) Init

func (p *RePlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*RePlugin) Name

func (p *RePlugin) Name() string

func (*RePlugin) Start

func (p *RePlugin) Start(_ context.Context) error

func (*RePlugin) Stop

func (p *RePlugin) Stop(_ context.Context) error

type ReloadPlugin

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

ReloadPlugin provides hot-reload functionality for external plugins.

func NewReload

func NewReload(pluginLoader *loader.Loader) *ReloadPlugin

func (*ReloadPlugin) Description

func (p *ReloadPlugin) Description() string

func (*ReloadPlugin) Init

func (p *ReloadPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*ReloadPlugin) Name

func (p *ReloadPlugin) Name() string

func (*ReloadPlugin) Start

func (p *ReloadPlugin) Start(_ context.Context) error

func (*ReloadPlugin) Stop

func (p *ReloadPlugin) Stop(_ context.Context) error

type RemindPlugin

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

RemindPlugin provides reminder functionality.

func NewRemind

func NewRemind() *RemindPlugin

func (*RemindPlugin) Description

func (p *RemindPlugin) Description() string

func (*RemindPlugin) Init

func (p *RemindPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*RemindPlugin) Name

func (p *RemindPlugin) Name() string

func (*RemindPlugin) Start

func (p *RemindPlugin) Start(ctx context.Context) error

func (*RemindPlugin) Stop

func (p *RemindPlugin) Stop(_ context.Context) error

type SaveDB

type SaveDB struct {
	Users map[string]UserConfig `json:"users"`
}

type SavePlugin

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

SavePlugin saves/forwards messages with metadata, bypassing forward limits. Inspired by TeleBox's save plugin.

func NewSave

func NewSave() *SavePlugin

func (*SavePlugin) Description

func (p *SavePlugin) Description() string

func (*SavePlugin) Init

func (p *SavePlugin) Init(ctx context.Context, mgr plugin.Manager) error

func (*SavePlugin) Name

func (p *SavePlugin) Name() string

func (*SavePlugin) Start

func (p *SavePlugin) Start(ctx context.Context) error

func (*SavePlugin) Stop

func (p *SavePlugin) Stop(ctx context.Context) error

type SavedFile

type SavedFile struct {
	FilePath         string    `json:"file_path"`
	MetadataPath     string    `json:"metadata_path"`
	RelativeFilePath string    `json:"relative_file_path"`
	SourceChatID     string    `json:"source_chat_id"`
	SourceChatTitle  string    `json:"source_chat_title"`
	SourceMessageID  int64     `json:"source_message_id"`
	SourceLink       string    `json:"source_link"`
	MediaType        string    `json:"media_type"`
	GroupedID        string    `json:"grouped_id,omitempty"`
	SavedAt          time.Time `json:"saved_at"`
}

type SendLogConfig

type SendLogConfig struct {
	Target string `json:"target"` // "me", chatID, or @username
}

type SendLogPlugin

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

SendLogPlugin sends log files to chat. Inspired by TeleBox's sendlog plugin.

func NewSendLog

func NewSendLog() *SendLogPlugin

func (*SendLogPlugin) Description

func (p *SendLogPlugin) Description() string

func (*SendLogPlugin) Init

func (p *SendLogPlugin) Init(ctx context.Context, mgr plugin.Manager) error

func (*SendLogPlugin) Name

func (p *SendLogPlugin) Name() string

func (*SendLogPlugin) Start

func (p *SendLogPlugin) Start(ctx context.Context) error

func (*SendLogPlugin) Stop

func (p *SendLogPlugin) Stop(ctx context.Context) error

type StatusPlugin

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

StatusPlugin provides detailed system status and metrics.

func NewStatus

func NewStatus(version string) *StatusPlugin

func (*StatusPlugin) Description

func (p *StatusPlugin) Description() string

func (*StatusPlugin) Init

func (p *StatusPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*StatusPlugin) Name

func (p *StatusPlugin) Name() string

func (*StatusPlugin) Start

func (p *StatusPlugin) Start(_ context.Context) error

func (*StatusPlugin) Stop

func (p *StatusPlugin) Stop(_ context.Context) error

type SudoPlugin

type SudoPlugin struct{}

SudoPlugin executes commands with sudo (owner only).

func NewSudo

func NewSudo() *SudoPlugin

func (*SudoPlugin) Description

func (p *SudoPlugin) Description() string

func (*SudoPlugin) Init

func (p *SudoPlugin) Init(_ context.Context, mgr plugin.Manager) error

func (*SudoPlugin) Name

func (p *SudoPlugin) Name() string

func (*SudoPlugin) Start

func (p *SudoPlugin) Start(_ context.Context) error

func (*SudoPlugin) Stop

func (p *SudoPlugin) Stop(_ context.Context) error

type UserConfig

type UserConfig struct {
	Target     string `json:"target"`      // @user, chatID, "me", "local"
	ShowSource bool   `json:"show_source"` // Whether to include source link
}

Jump to

Keyboard shortcuts

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