rulebot

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewContext, New)

Functions

This section is empty.

Types

type Context added in v0.0.24

type Context struct {
	Conf   *config.AppConfig
	RDB    *redis.Client
	Logger *logger.Logger

	MessageClient   pb.MessageClient
	MiddleClient    pb.MiddleClient
	SubscribeClient pb.SubscribeClient
	WorkflowClient  pb.WorkflowClient
	StorageClient   pb.StorageClient
	TodoClient      pb.TodoClient
	UserClient      pb.UserClient
	NLPClient       pb.NLPClient
}

func (Context) GetConfig added in v0.0.24

func (c Context) GetConfig() *config.AppConfig

func (Context) GetLogger added in v0.0.24

func (c Context) GetLogger() *logger.Logger

func (Context) GetRedis added in v0.0.24

func (c Context) GetRedis() *redis.Client

func (Context) Message added in v0.0.24

func (c Context) Message() pb.MessageClient

func (Context) Middle added in v0.0.24

func (c Context) Middle() pb.MiddleClient

func (Context) NLP added in v0.0.24

func (c Context) NLP() pb.NLPClient

func (Context) Storage added in v0.0.24

func (c Context) Storage() pb.StorageClient

func (Context) Subscribe added in v0.0.24

func (c Context) Subscribe() pb.SubscribeClient

func (Context) Todo added in v0.0.24

func (c Context) Todo() pb.TodoClient

func (Context) User added in v0.0.24

func (c Context) User() pb.UserClient

func (Context) Workflow added in v0.0.24

func (c Context) Workflow() pb.WorkflowClient

type IContext added in v0.0.24

type IContext interface {
	GetConfig() *config.AppConfig
	GetRedis() *redis.Client
	GetLogger() *logger.Logger
	Message() pb.MessageClient
	Middle() pb.MiddleClient
	Subscribe() pb.SubscribeClient
	Workflow() pb.WorkflowClient
	Storage() pb.StorageClient
	Todo() pb.TodoClient
	User() pb.UserClient
	NLP() pb.NLPClient
}

func NewContext added in v0.0.24

func NewContext(
	conf *config.AppConfig,
	rdb *redis.Client,
	logger *logger.Logger,

	messageClient pb.MessageClient,
	middleClient pb.MiddleClient,
	subscribeClient pb.SubscribeClient,
	workflowClient pb.WorkflowClient,
	storageClient pb.StorageClient,
	todoClient pb.TodoClient,
	userClient pb.UserClient,
	nlpClient pb.NLPClient,
) IContext

type Option

type Option func(*RuleBot)

func RegisterRuleset

func RegisterRuleset(rule RuleParser) Option

type RuleBot

type RuleBot struct {
	Ctx IContext
	// contains filtered or unexported fields
}

func CreateRuleBot added in v0.0.24

func CreateRuleBot(id string) (*RuleBot, error)

func New

func New(ctx IContext) *RuleBot

func (*RuleBot) MessageProviderOut

func (s *RuleBot) MessageProviderOut() []string

func (*RuleBot) Name

func (s *RuleBot) Name() string

func (*RuleBot) Process

func (s *RuleBot) Process(in string) *RuleBot

func (*RuleBot) SetOptions added in v0.0.24

func (s *RuleBot) SetOptions(opts ...Option)

type RuleParser

type RuleParser interface {
	Name() string
	Boot(*RuleBot)
	ParseMessage(*RuleBot, string) []string
	HelpMessage(*RuleBot, string) string
}

Jump to

Keyboard shortcuts

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