Skip to content

mtgo-labs/plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mtgo plugins

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

Available Plugins

Plugin Description
conversations Multi-step conversation state management with persistent storage
i18n Internationalization with YAML/FTL formats and 25+ plural rules

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:

type Plugin interface {
    Name() string
    HandleUpdate(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

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages