config

package
v0.0.0-...-8f83242 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL        = "https://api.telegram.org/bot"
	StoreFile      = "store.gob"
	PollTimeoutSec = 60
	UserIdRegex    = "(?m)^-?\\d+$"
)
View Source
const (
	KeyUpdateID  = "latestUpdateId"
	KeyMessage   = "message"
	KeyParams    = "message_params"
	KeyRecipient = "recipient"
)
View Source
const (
	CmdPatternStart  = `/start`
	CmdPatternRevoke = `/revoke\s?(\d*)$`
	CmdPatternHelp   = `/help`
)
View Source
const (
	MessageDefaultResponse    = "Please use the _/start_ command to fetch a new token.\n\nFurther information at https://github.com/muety/telepush."
	MessageTokenResponse      = "Successfully created new token: `%s`."
	MessageRevokeList         = "Currently active tokens:\n\n%s\n\nSend `/revoke <number>` to revoke a certain token."
	MessageRevokeListEmpty    = "No active tokens. Send `/start` to generate new one."
	MessageRevokeSuccessful   = "Token `%s` revoked."
	MessageRevokeInvalidIndex = "%d is not a valid token index."
	MessageHelpResponse       = "" /* 173-byte string literal not displayed */
)
View Source
const (
	EventOnRequestFailed     = "on_request_failed"
	EventOnRequestSuccessful = "on_request_successful"
	EventOnMessageDelivered  = "on_message_delivered"
	EventOnTokenIssued       = "on_user_registered"
)
View Source
const (
	FieldMessageOrigin    = "origin"
	FieldMessageType      = "type"
	FieldMessageRecipient = "chat_id"
	FieldTokenToken       = "token"
	FieldTokenChat        = "chat_id"
	FieldTokenUser        = "user_id"
)

Variables

View Source
var (
	CmdStart  *regexp.Regexp
	CmdRevoke *regexp.Regexp
	CmdHelp   *regexp.Regexp
)
View Source
var Version string

Functions

func AllEvents

func AllEvents() []string

func GetHub

func GetHub() *hub.Hub

func GetStore

func GetStore() store.Store

Types

type BotConfig

type BotConfig struct {
	Env          string
	Token        string
	Mode         string
	BaseUrl      string
	UseHTTPS     bool
	CertPath     string
	KeyPath      string
	ProxyURI     *url.URL
	Port         int
	UrlSecret    string
	ReqRateLimit int
	CmdRateLimit int
	TruncateMsgs bool
	Address      string
	Address6     string
	Disable6     bool
	Metrics      bool
	DataDir      string
	InletsDir    string
	Blacklist    []int64
	Whitelist    []int64
	Version      string
}

func Get

func Get() *BotConfig

func (*BotConfig) GetApiUrl

func (c *BotConfig) GetApiUrl() string

func (*BotConfig) GetStorePath

func (c *BotConfig) GetStorePath() string

func (*BotConfig) GetUpdatesPath

func (c *BotConfig) GetUpdatesPath() string

func (*BotConfig) IsDev

func (c *BotConfig) IsDev() bool

Jump to

Keyboard shortcuts

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