teleutils

module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT

README

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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