utils

package
v0.0.0-...-eb4b608 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnMsg = "\agobot_msg" // Shortcut for handling any message

	Day  = 24 * time.Hour
	Week = 7 * Day

	InlineQueryFailureCacheTime = 2 // In seconds

	MaxMessageLength            = 4096
	MaxFilesizeDownload         = 20000000 // Max filesize that can be downloaded from Telegram = 20MB
	MaxFilesizeUpload           = 50000000 // Max filesize that can be uploaded to Telegram = 50MB
	MaxPhotosizeUpload          = 10000000 // Max filesize of photos that can be uploaded to Telegram = 10 MB
	MaxPhotosizeThroughTelegram = 5000000  // Max filesize of photos that Telegram can send automatically = 5 MB

	UserAgent = "Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
)

Variables

View Source
var (
	DefaultSendOptions = &telebot.SendOptions{
		AllowWithoutReply:     true,
		DisableWebPagePreview: true,
		DisableNotification:   true,
		ParseMode:             telebot.ModeHTML,
	}
)

Functions

func AnyEntities

func AnyEntities(message *telebot.Message) telebot.Entities

func EmbedGUID

func EmbedGUID(guid string) string

func EmbedImage

func EmbedImage(url string) string

func Escape

func Escape(s string) string

func FormatFloat

func FormatFloat(f float64) string

func FormatThousand

func FormatThousand[T constraints.Integer](n T) string

func FullName

func FullName(firstName, lastName string) string

func GermanTimezone

func GermanTimezone() *time.Location

func HumanizeDuration

func HumanizeDuration(d *duration.Duration) string

func IsAdmin

func IsAdmin(user *telebot.User) bool

func LocalizeDatestring

func LocalizeDatestring(date string) string

func RoundAndFormatThousand

func RoundAndFormatThousand(n float64) string

Types

type VersionInfo

type VersionInfo struct {
	GoVersion  string
	GoOS       string
	GoArch     string
	Revision   string
	LastCommit time.Time
	DirtyBuild bool
}

func ReadVersionInfo

func ReadVersionInfo() (VersionInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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