Telebot utils (teleutils)
teleutils
is a lightweight set of utilities for working with telebot
. It provides support for scenes, sessions, and stories, as well as simple functions for sending errors and editing messages.
Installation
To install teleutils
, use the following command:
go get -u github.com/tyrenix/teleutils
Quick Start
package teleutils
import (
"github.com/tyrenix/teleutils/bot"
"github.com/tyrenix/teleutils/router"
"gopkg.in/telebot.v3"
"gopkg.in/telebot.v3/middleware"
)
func main() {
// create bot
bot, err := bot.NewBot(&telebot.Settings{
Token: "TOKEN",
})
// is error
if err != nil {
panic(err)
}
router.
NewRouter(bot).
// middlewares
WithMiddleware(
middleware.Recover(), // gracefully recover
// add others middlewares
).
// public handlers
WithHandler(
// handlers
).
// collect tg bot
Collect()
// start tg bot
bot.Start()
}
Documentation
For detailed documentation, including API reference and additional examples, visit the official documentation on pkg.go.dev.
License
This project is licensed under the MIT License. See the LICENSE file for details.