commandparser

package
v0.0.0-...-b1dd1d8 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C struct {
	Room string
	From string
	Name string
	Src  string
	Args []string
}

func (C) Float64

func (c C) Float64(index int) float64

func (C) Int64

func (c C) Int64(index int) int64

func (C) String

func (c C) String(index int) string

type Handler

type Handler struct {
	Fn          HandlerFunc
	Description string
}

type HandlerFunc

type HandlerFunc func(C)

type HelpCommand

type HelpCommand struct {
	Command     string
	Description string
}

type HelpCommands

type HelpCommands struct {
	Header   template.HTML
	Commands []HelpCommand
}

func (HelpCommands) Len

func (hc HelpCommands) Len() int

func (HelpCommands) Less

func (hc HelpCommands) Less(i, j int) bool

func (HelpCommands) Swap

func (hc HelpCommands) Swap(i, j int)

type Parser

type Parser struct {
	Prefix           rune
	MaxLen           int64
	MaxSpamPerMinute int64

	AntiSpam *sync.Map
	// contains filtered or unexported fields
}

func New

func New() *Parser

func (*Parser) AddScore

func (p *Parser) AddScore(room, user string, value int64)

func (*Parser) Help

func (p *Parser) Help() HelpCommands

func (*Parser) On

func (p *Parser) On(cmd, description string, cb HandlerFunc)

func (*Parser) Parse

func (p *Parser) Parse(room, from, data string)

func (*Parser) Rgx

func (p *Parser) Rgx(cmd, description string, cb HandlerFunc)

type SpamData

type SpamData struct {
	LastCommand time.Time
	SpamScore   int64
}

Jump to

Keyboard shortcuts

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