helpers

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIELD_DATE        = "date"
	FIELD_DESCRIPTION = "description"
	FIELD_AMOUNT      = "amount"
	FIELD_ACCOUNT     = "account"
	FIELD_TAG         = "tag"

	FIELD_ACCOUNT_FROM = "from"
	FIELD_ACCOUNT_TO   = "to"

	DOT_INDENT = 47

	BEANCOUNT_DATE_FORMAT = "2006-01-02"

	USERSET_CUR          = "user.currency"
	USERSET_ADM          = "user.isAdmin"
	USERSET_TAG          = "user.vacationTag"
	USERSET_TZOFF        = "user.tzOffset"
	USERSET_OMITCMDSLASH = "user.omitCommandSlash"
	USERSET_ENABLEAPI    = "user.enableApi"

	DEFAULT_CURRENCY = "EUR"

	TG_MAX_MSG_CHAR_LEN = 4096

	MAX_REPLY_KEYBOARD_ENTRIES = 40
)
View Source
const (
	TRACE = Level(iota)
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
)

Variables

View Source
var ErrApiDisabled error = errors.New("api feature is not enabled for user")
View Source
var ErrApiInvalidTokenVerification error = errors.New("invalid token verification")
View Source
var ErrApiTokenChallengeInProgress error = errors.New("there is already a token challenge in progress. need to wait for timeout")

Functions

func AllowedSuggestionTypes

func AllowedSuggestionTypes() []string

func ArrayContains

func ArrayContains(s []string, e string) bool

func ArrayContainsC

func ArrayContainsC(s []string, e string, caseSensitive bool) bool

func ArraysEqual

func ArraysEqual(a, b []string) bool

func Env

func Env(k string) string

func EnvOrFb

func EnvOrFb(k string, fb string) string

func FqCacheKey added in v0.21.0

func FqCacheKey(key string) string

func LogLocalf

func LogLocalf(level Level, m *tb.Message, format string, v ...interface{}) (prefix, message string)

func LogMessagePrefix

func LogMessagePrefix(m *tb.Message) string

func SplitQuotedCommand

func SplitQuotedCommand(s string) (res []string)

func Template

func Template(tmpl string, values map[string]interface{}) (string, error)

func TestExpect

func TestExpect(t *testing.T, e1 interface{}, e2 interface{}, msg string)

func TestExpectArrEq

func TestExpectArrEq(t *testing.T, e1, e2 []string, msg string)

func TestStringContains

func TestStringContains(t *testing.T, s, substring, msg string)

func TypeCacheKey added in v0.21.0

func TypeCacheKey(key string) string

Types

type Level

type Level int

func (Level) String

func (l Level) String() string

type SubcommandHandler

type SubcommandHandler struct {
	// contains filtered or unexported fields
}

func MakeSubcommandHandler

func MakeSubcommandHandler(base string, quotedSingleParams bool) *SubcommandHandler

func (*SubcommandHandler) Add

func (sh *SubcommandHandler) Add(command string, handler handlerFunc) *SubcommandHandler

func (*SubcommandHandler) Handle

func (sh *SubcommandHandler) Handle(m *tb.Message) ([]string, error)

type TV

type TV struct {
	T     string
	Value string
}

func ExtractTypeValue

func ExtractTypeValue(params ...string) (*TV, error)

Jump to

Keyboard shortcuts

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