rules

package
v0.0.0-...-c531dcc Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case struct {
	Name         string
	Conditions   []Condition
	Responses    []Response
	ResponseFunc func(event provider.Event, p provider.Provider) bool
}

type ChannelEqualsCondition

type ChannelEqualsCondition struct {
	Condition string
}

func NewChannelEqualsCondition

func NewChannelEqualsCondition(condition string) (*ChannelEqualsCondition, error)

func (ChannelEqualsCondition) Test

func (c ChannelEqualsCondition) Test(event provider.Event) bool

type ChannelIsTypeCondition

type ChannelIsTypeCondition struct {
	Condition string
}

func NewChannelIsTypeCondition

func NewChannelIsTypeCondition(condition string) (*ChannelIsTypeCondition, error)

func (ChannelIsTypeCondition) Test

func (c ChannelIsTypeCondition) Test(event provider.Event) bool

type Condition

type Condition interface {
	Test(event provider.Event) bool
}

type DeleteMessageResponse

type DeleteMessageResponse struct {
}

func NewDeleteMessageResponse

func NewDeleteMessageResponse() (*DeleteMessageResponse, error)

func (DeleteMessageResponse) Execute

type Engine

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

func NewEngine

func NewEngine(caseDir string) *Engine

func (*Engine) AddCase

func (e *Engine) AddCase(caseType string, newCase Case)

func (*Engine) EvaluateEvent

func (e *Engine) EvaluateEvent(event provider.Event) bool

func (*Engine) ReloadCaseFile

func (e *Engine) ReloadCaseFile(caseType string) bool

func (*Engine) ReloadCaseFiles

func (e *Engine) ReloadCaseFiles()

func (*Engine) SetProvider

func (e *Engine) SetProvider(provider provider.Provider)

func (*Engine) Start

func (e *Engine) Start()

type InviteUserResponse

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

func NewInviteUserResponse

func NewInviteUserResponse(channelID, userID string) (*InviteUserResponse, error)

func (InviteUserResponse) Execute

func (k InviteUserResponse) Execute(p provider.Provider, event provider.Event) bool

type KickUserResponse

type KickUserResponse struct {
	ChannelID string
	UserID    string
}

func NewKickUserResponse

func NewKickUserResponse(channelID, userID string) (*KickUserResponse, error)

func (KickUserResponse) Execute

func (k KickUserResponse) Execute(p provider.Provider, event provider.Event) bool

type MessageChannelResponse

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

func NewMessageChannelResponse

func NewMessageChannelResponse(channelID, message string) (*MessageChannelResponse, error)

func (MessageChannelResponse) Execute

type MessageUserResponse

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

func NewMessageUserResponse

func NewMessageUserResponse(userID, message string) (*MessageUserResponse, error)

func (MessageUserResponse) Execute

type RandomCondition

type RandomCondition struct {
	Likeness int
}

func NewRandomCondition

func NewRandomCondition(likeness int) (*RandomCondition, error)

func (RandomCondition) Test

func (t RandomCondition) Test(event provider.Event) bool

type Response

type Response interface {
	Execute(p provider.Provider, event provider.Event) bool
}

type TextContainsCondition

type TextContainsCondition struct {
	Condition string
}

func NewTextContainsCondition

func NewTextContainsCondition(condition string) (*TextContainsCondition, error)

func (TextContainsCondition) Test

func (t TextContainsCondition) Test(event provider.Event) bool

type TextEqualsCondition

type TextEqualsCondition struct {
	Condition string
}

func NewTextEqualsCondition

func NewTextEqualsCondition(condition string) (*TextEqualsCondition, error)

func (TextEqualsCondition) Test

func (t TextEqualsCondition) Test(event provider.Event) bool

type TextMatchesCondition

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

func NewTextMatchesCondition

func NewTextMatchesCondition(expression string) (*TextMatchesCondition, error)

func (TextMatchesCondition) Test

func (t TextMatchesCondition) Test(event provider.Event) bool

type TextStartsWithCondition

type TextStartsWithCondition struct {
	Condition string
}

func NewTextStartsWithCondition

func NewTextStartsWithCondition(condition string) (*TextStartsWithCondition, error)

func (TextStartsWithCondition) Test

type UserEqualsCondition

type UserEqualsCondition struct {
	Condition string
	Parameter string
}

func NewUserEqualsCondition

func NewUserEqualsCondition(condition, parameter string) (*UserEqualsCondition, error)

func (UserEqualsCondition) Test

func (u UserEqualsCondition) Test(event provider.Event) bool

type UserIsRoleCondition

type UserIsRoleCondition struct {
	Condition string
	Parameter string
}

func NewUserIsRoleCondition

func NewUserIsRoleCondition(condition, parameter string) (*UserIsRoleCondition, error)

func (UserIsRoleCondition) Test

func (u UserIsRoleCondition) Test(event provider.Event) bool

Jump to

Keyboard shortcuts

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