builtin

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FinishRestart added in v0.1.1

func FinishRestart(ctx context.Context, api restartAPI, resolve func(context.Context, int64) (tg.InputPeerClass, error))

FinishRestart edits the restart message after the process came back. Called by the app once the client is authorized.

Types

type AliasPlugin

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

AliasPlugin manages runtime command aliases with persistent storage. Aliases are expanded once during command parsing; they do not nest.

func NewAlias

func NewAlias() *AliasPlugin

func (*AliasPlugin) DescEN added in v0.1.1

func (p *AliasPlugin) DescEN() string

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 AptPlugin

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

AptPlugin manages external plugins. Installed always means loaded.

func NewApt

func NewApt(pluginLoader *loader.Loader) *AptPlugin

func (*AptPlugin) DescEN added in v0.1.1

func (p *AptPlugin) DescEN() string

func (*AptPlugin) Description

func (p *AptPlugin) Description() string

func (*AptPlugin) Init

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

func (*AptPlugin) Name

func (p *AptPlugin) Name() string

func (*AptPlugin) Start

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

func (*AptPlugin) Stop

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

type BackupPlugin

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

BackupPlugin packs bot configuration (config + plugin data) and ships it to Saved Messages; restore reads an archive from a replied message.

func NewBackup

func NewBackup() *BackupPlugin

func (*BackupPlugin) DescEN added in v0.1.1

func (p *BackupPlugin) DescEN() string

func (*BackupPlugin) Description

func (p *BackupPlugin) Description() string

func (*BackupPlugin) Init

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

func (*BackupPlugin) Name

func (p *BackupPlugin) Name() string

func (*BackupPlugin) SetConfig

func (p *BackupPlugin) SetConfig(path string)

SetConfig wires the active config path into backups.

func (*BackupPlugin) Start

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

func (*BackupPlugin) Stop

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

type DCPlugin added in v0.1.2

type DCPlugin struct{}

DCPlugin tells which data center a user, group or channel lives on. The DC of a profile photo is the only public hint, so targets without a photo cannot be located.

func NewDC added in v0.1.2

func NewDC() *DCPlugin

func (*DCPlugin) DescEN added in v0.1.2

func (p *DCPlugin) DescEN() string

func (*DCPlugin) Description added in v0.1.2

func (p *DCPlugin) Description() string

func (*DCPlugin) Init added in v0.1.2

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

func (*DCPlugin) Name added in v0.1.2

func (p *DCPlugin) Name() string

func (*DCPlugin) Start added in v0.1.2

func (p *DCPlugin) Start(context.Context) error

func (*DCPlugin) Stop added in v0.1.2

func (p *DCPlugin) Stop(context.Context) error

type ExecPlugin

type ExecPlugin struct{}

ExecPlugin executes shell commands (owner only).

func NewExec

func NewExec() *ExecPlugin

func (*ExecPlugin) DescEN added in v0.1.1

func (p *ExecPlugin) DescEN() string

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 HelpPlugin

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

HelpPlugin lists commands grouped by plugin and shows detailed usage.

func NewHelp

func NewHelp() *HelpPlugin

func (*HelpPlugin) DescEN added in v0.1.1

func (p *HelpPlugin) DescEN() string

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 a detailed profile card for a user plus the current chat and message IDs, modeled on TeleBox's ids plugin.

func NewInfo

func NewInfo() *InfoPlugin

func (*InfoPlugin) DescEN added in v0.1.1

func (p *InfoPlugin) DescEN() string

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 LanguagePlugin added in v0.1.1

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

LanguagePlugin holds the interface language. It has no command: the language is a setting, switched in the bot panel. The choice is global (one person's userbot) and persists across restarts.

func NewLanguage added in v0.1.1

func NewLanguage(mgr *i18n.Manager) *LanguagePlugin

func (*LanguagePlugin) DescEN added in v0.1.1

func (p *LanguagePlugin) DescEN() string

func (*LanguagePlugin) Description added in v0.1.1

func (p *LanguagePlugin) Description() string

func (*LanguagePlugin) Init added in v0.1.1

func (*LanguagePlugin) Name added in v0.1.1

func (p *LanguagePlugin) Name() string

func (*LanguagePlugin) Start added in v0.1.1

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

func (*LanguagePlugin) Stop added in v0.1.1

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

type LogPlugin

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

LogPlugin delivers log files. The level and the delivery target are settings in the bot panel; the command only performs actions.

func NewLog

func NewLog() *LogPlugin

func (*LogPlugin) DescEN added in v0.1.1

func (p *LogPlugin) DescEN() string

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 PingPlugin added in v0.1.1

type PingPlugin struct{}

PingPlugin measures latency to Telegram, its data centers and any host.

func NewPing added in v0.1.1

func NewPing() *PingPlugin

func (*PingPlugin) DescEN added in v0.1.1

func (p *PingPlugin) DescEN() string

func (*PingPlugin) Description added in v0.1.1

func (p *PingPlugin) Description() string

func (*PingPlugin) Init added in v0.1.1

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

func (*PingPlugin) Name added in v0.1.1

func (p *PingPlugin) Name() string

func (*PingPlugin) Start added in v0.1.1

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

func (*PingPlugin) Stop added in v0.1.1

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

type PrefixPlugin

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

PrefixPlugin holds the command prefixes. It has no command: prefixes are settings, changed in the bot panel. Defaults come from config.json.

func NewPrefix

func NewPrefix() *PrefixPlugin

func (*PrefixPlugin) DescEN added in v0.1.1

func (p *PrefixPlugin) DescEN() string

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) Prefixes added in v0.1.1

func (p *PrefixPlugin) Prefixes() []string

Prefixes returns main first, then the extras without duplicates.

func (*PrefixPlugin) Start

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

func (*PrefixPlugin) Stop

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

type PrunePlugin

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

PrunePlugin deletes messages in the current chat, TeleBox-dme style.

func NewPrune

func NewPrune() *PrunePlugin

func (*PrunePlugin) DescEN added in v0.1.1

func (p *PrunePlugin) DescEN() string

func (*PrunePlugin) Description

func (p *PrunePlugin) Description() string

func (*PrunePlugin) Init

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

func (*PrunePlugin) Name

func (p *PrunePlugin) Name() string

func (*PrunePlugin) Start

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

func (*PrunePlugin) Stop

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

type RePlugin added in v0.1.1

type RePlugin struct{}

RePlugin repeats replied messages: delete the command, forward the target into this chat, and copy it verbatim where forwarding is banned.

func NewRe added in v0.1.1

func NewRe() *RePlugin

func (*RePlugin) DescEN added in v0.1.1

func (p *RePlugin) DescEN() string

func (*RePlugin) Description added in v0.1.1

func (p *RePlugin) Description() string

func (*RePlugin) Init added in v0.1.1

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

func (*RePlugin) Name added in v0.1.1

func (p *RePlugin) Name() string

func (*RePlugin) Start added in v0.1.1

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

func (*RePlugin) Stop added in v0.1.1

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

type ReloadPlugin

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

ReloadPlugin hot-reloads every external plugin.

func NewReload

func NewReload(pluginLoader *loader.Loader) *ReloadPlugin

func (*ReloadPlugin) DescEN added in v0.1.1

func (p *ReloadPlugin) DescEN() string

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 RestartPlugin added in v0.1.1

type RestartPlugin struct {
	// BeforeRestart lets the app flush state (session, plugins) before the
	// process image is replaced.
	BeforeRestart func()
}

RestartPlugin re-executes the bot in place.

func NewRestart added in v0.1.1

func NewRestart() *RestartPlugin

func (*RestartPlugin) DescEN added in v0.1.1

func (p *RestartPlugin) DescEN() string

func (*RestartPlugin) Description added in v0.1.1

func (p *RestartPlugin) Description() string

func (*RestartPlugin) Init added in v0.1.1

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

func (*RestartPlugin) Name added in v0.1.1

func (p *RestartPlugin) Name() string

func (*RestartPlugin) Restart added in v0.1.1

func (p *RestartPlugin) Restart(ctx *interfaces.CommandContext) error

Restart is exported so update can reuse the same restart flow.

func (*RestartPlugin) Start added in v0.1.1

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

func (*RestartPlugin) Stop added in v0.1.1

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

type StatusPlugin

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

StatusPlugin reports version, host and resource usage.

func NewStatus

func NewStatus(version string, l *loader.Loader) *StatusPlugin

func (*StatusPlugin) DescEN added in v0.1.1

func (p *StatusPlugin) DescEN() string

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 {
	// contains filtered or unexported fields
}

SudoPlugin implements permission delegation: the owner can let other Telegram users run the userbot's commands. Granting needs a person from the chat, so add/remove stay commands; the master switch and the list live in the bot panel.

func NewSudo

func NewSudo() *SudoPlugin

func (*SudoPlugin) DescEN added in v0.1.1

func (p *SudoPlugin) DescEN() string

func (*SudoPlugin) Description

func (p *SudoPlugin) Description() string

func (*SudoPlugin) Init

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

func (*SudoPlugin) IsSudoUser

func (p *SudoPlugin) IsSudoUser(userID int64) bool

IsSudoUser reports whether the given user is permitted. Delegation only works while the switch is on.

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 UpdatePlugin

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

UpdatePlugin upgrades the running binary from GitHub Releases.

func NewUpdate

func NewUpdate(version string, restart func(*interfaces.CommandContext) error) *UpdatePlugin

func (*UpdatePlugin) DescEN added in v0.1.1

func (p *UpdatePlugin) DescEN() string

func (*UpdatePlugin) Description

func (p *UpdatePlugin) Description() string

func (*UpdatePlugin) Init

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

func (*UpdatePlugin) Name

func (p *UpdatePlugin) Name() string

func (*UpdatePlugin) Start

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

func (*UpdatePlugin) Stop

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

Jump to

Keyboard shortcuts

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