utils

package
v0.0.0-...-d0b85f4 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTTPCaller = &HTTPCaller{
	Client: &http.Client{
		Transport: &http.Transport{
			MaxConnsPerHost: 1024,
		},
	},
}
View Source
var DisableableCommands []string
View Source
var ErrMaxRetryAttempts = errors.New("max retry attempts reached")

Functions

func CheckDisabledCommand

func CheckDisabledCommand(command string, chatID int64) bool

func CheckDisabledMiddleware

func CheckDisabledMiddleware(next bot.HandlerFunc) bot.HandlerFunc

func EscapeHTML

func EscapeHTML(s string) string

func FileTypeByFileID

func FileTypeByFileID(fileID string) int32

func FormatText

func FormatText(text string, entities []models.MessageEntity) string

func GetHelpKeyboard

func GetHelpKeyboard(i18n func(string, ...map[string]any) string) [][]models.InlineKeyboardButton

func IsGroup

func IsGroup(next bot.HandlerFunc) bot.HandlerFunc

func RandomString

func RandomString(n int) string

func Request

func Request(url string, params RequestParams) (*http.Response, error)

func ResizeSticker

func ResizeSticker(input []byte) ([]byte, error)

func ResizeThumbnail

func ResizeThumbnail(input []byte) ([]byte, error)

func SanitizeString

func SanitizeString(input string) string

func SaveHelp

func SaveHelp(name string)

Types

type HTTPCaller

type HTTPCaller struct {
	Client *http.Client
}

func (HTTPCaller) Call

func (a HTTPCaller) Call(url string, params RequestParams) (*http.Response, error)

type RequestParams

type RequestParams struct {
	Method     string
	Redirects  int
	Proxy      bool
	Headers    map[string]string
	Query      map[string]string
	BodyString []string
}

type RetryCaller

type RetryCaller struct {
	Caller       *HTTPCaller
	MaxAttempts  int
	ExponentBase float64
	StartDelay   time.Duration
	MaxDelay     time.Duration
}

func (*RetryCaller) Request

func (r *RetryCaller) Request(url string, params RequestParams) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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