Skip to content

Repository files navigation

mtgo plugins

Official plugin collection for mtgo — a Go MTProto client for Telegram bots and userbots.

Available Plugins

PluginDescription
conversationsMulti-step conversation state management with persistent storage
i18nInternationalization with YAML/FTL formats and 25+ plural rules
schedulerIn-memory job scheduler with retry/backoff, bounded concurrency, and graceful shutdown
fsmFinite-state-machine and key-value state management with TTL, scoping, and persistent storage
throttleLocal anti-spam rate limiting with global, per-chat, per-user, per-method, and custom-key scopes
updatesrecoveryPersist and restore Telegram update state (pts/qts/date/seq) with gap detection and getDifference recovery
rawdebugOptional raw MTProto traffic inspector for development and debugging (RPC, updates, errors, redaction)

Usage

Plugins implement the tg.Plugin interface and are registered with client.Use():

client, _:=tg.NewClient(apiID, apiHash, &tg.Config{
BotToken: botToken,
SessionName: "my_bot",
})
client.Use(myPlugin)

Multiple plugins can be chained — they form a middleware stack where each plugin intercepts updates before passing them along.

Writing a Plugin

A plugin is any type that implements the Plugin interface:

typePlugininterface {
Name() stringHandleUpdate(ctx*Context, update tg.TLObject) error
}

Register handlers inside HandleUpdate, inspect updates, and call ctx.Next() to pass control to the next plugin or handler in the chain.

License

MIT

About

Official plugin collection for mtgo — a Go MTProto client for Telegram bots and userbots

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages