rules

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalRuleName   = "local"
	LocalRuleAuthor = "local"
)

Variables

This section is empty.

Functions

func HashBytes

func HashBytes(b []byte) string

Types

type AvatarMatcher

type AvatarMatcher interface {
	Match(hexDigest string) *MatchResult
	Type() avatarMatchType
}

AvatarMatcher provides an interface to match avatars using custom methods

type Engine

type Engine struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func New added in v0.0.6

func New(localRules *RuleSchema, localPlayers *PlayerListSchema) (*Engine, error)

func (*Engine) ExportPlayers

func (e *Engine) ExportPlayers(listName string, w io.Writer) error

ExportPlayers writes the json encoded player list matching the listName provided to the io.Writer

func (*Engine) ExportRules

func (e *Engine) ExportRules(listName string, w io.Writer) error

ExportRules writes the json encoded rules list matching the listName provided to the io.Writer

func (*Engine) FindNewestEntries added in v0.0.8

func (e *Engine) FindNewestEntries(max int, validAttrs []string) steamid.Collection

func (*Engine) ImportPlayers

func (e *Engine) ImportPlayers(list *PlayerListSchema) (int, error)

ImportPlayers loads the provided player list for matching

func (*Engine) ImportRules

func (e *Engine) ImportRules(list *RuleSchema) (int, error)

ImportRules loads the provided ruleset for use

func (*Engine) Mark

func (e *Engine) Mark(opts MarkOpts) error

func (*Engine) MatchMessage

func (e *Engine) MatchMessage(text string) *MatchResult

func (*Engine) MatchName

func (e *Engine) MatchName(name string) *MatchResult

func (*Engine) MatchSteam

func (e *Engine) MatchSteam(steamID steamid.SID64) *MatchResult

func (*Engine) UniqueTags

func (e *Engine) UniqueTags() []string

UniqueTags returns a list of the unique known tags across all player lists

func (*Engine) Unmark added in v0.0.8

func (e *Engine) Unmark(steamID steamid.SID64) bool

type MarkOpts

type MarkOpts struct {
	SteamID    steamid.SID64
	Attributes []string
	Proof      []string
	Name       string
}

type MatchResult

type MatchResult struct {
	Origin     string // Title of the list that the match was generated against
	Attributes []string
	//Proof       []string
	MatcherType string
}

type PlayerListSchema

type PlayerListSchema struct {
	Players []playerDefinition `json:"players"`
	// contains filtered or unexported fields
}

func NewPlayerListSchema

func NewPlayerListSchema(players ...playerDefinition) PlayerListSchema

type RuleSchema

type RuleSchema struct {
	Rules []ruleDefinition `json:"rules" yaml:"rules"`
	// contains filtered or unexported fields
}

func NewRuleSchema

func NewRuleSchema(rules ...ruleDefinition) RuleSchema

type SteamIDMatcher

type SteamIDMatcher interface {
	Match(sid64 steamid.SID64) *MatchResult
}

SteamIDMatcher provides a basic interface to match steam ids.

type TextMatcher

type TextMatcher interface {
	// Match performs a text based match
	Match(text string) *MatchResult
	Type() textMatchType
}

TextMatcher provides an interface to build text based matchers for names or in game messages

Jump to

Keyboard shortcuts

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