matchers

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgreeString = "Точно!"
)

Variables

View Source
var (
	NumberMatcher         = NewRegexMather(`[\-]{0,1}[0-9]+[\.][0-9]+|[\-]{0,1}[0-9]+`)
	PositiveNumberMatcher = NewRegexMather(`^\+?(0*[1-9]\d*(?:[\., ]\d+)*) *(?:\p{Sc}|°[FC])?$`)
	AnyMatcher            = NewRegexMather(`.*`)
	FirstWord             = NewRegexMather(`[^\s]+`)
	PositiveNumberError   = scene.BaseTextError{
		Message: positiveNumberErrorString,
	}
	NumberError = scene.BaseTextError{
		Message: numberErrorString,
	}
)
View Source
var (
	Agree = NewSelectorMatcher(
		[]string{
			"Точно",
			"Согласен",
			"Да",
			"Ага",
		},
		AgreeString,
	)
)

Functions

This section is empty.

Types

type RegexMatcher

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

func NewRegexMather

func NewRegexMather(pattern string) *RegexMatcher

func (*RegexMatcher) Match

func (rm *RegexMatcher) Match(message string) (bool, string)

type SelectorMatcher

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

func NewSelectorMatcher

func NewSelectorMatcher(variants []string, replaceMessage string) *SelectorMatcher

func (*SelectorMatcher) Match

func (rm *SelectorMatcher) Match(message string) (bool, string)

Jump to

Keyboard shortcuts

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