robots

package
v0.0.0-...-0e0034f Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Robot

type Robot struct {
	*model.RobotAttributes

	// components
	Queue  queue2.QueueInterface
	Logger *logger.Logger

	// Middlewares
	ErrorHandler        model.HandleError
	PreMessageHandlers  []model.HandlePreSend
	PostMessageHandlers []model.HandlePostReply

	// functional
	IsWorking bool
	Mutex     sync.Mutex
	ErrorChan chan *model.ErrReply

	// webhook
	NotifyUrl string
}

func NewRobot

func NewRobot(attributes *model.RobotAttributes) (*Robot, error)

func (*Robot) CreateImageMessage

func (bot *Robot) CreateImageMessage(content interface{}) (*model.Message, error)

func (*Robot) CreateMessage

func (bot *Robot) CreateMessage(messageType model.MessageType, content interface{}) (*model.Message, error)

func (*Robot) CreateTextMessage

func (bot *Robot) CreateTextMessage(content interface{}) (*model.Message, error)

func (*Robot) IsAwaken

func (bot *Robot) IsAwaken(ctx context.Context) error

func (*Robot) Receive

func (bot *Robot) Receive(ctx context.Context)

func (*Robot) Send

func (bot *Robot) Send(ctx context.Context, message *model.Message) (*model.Job, error)

func (*Robot) SetErrorHandler

func (bot *Robot) SetErrorHandler(handle model.HandleError)

func (*Robot) SetMessagePreHandler

func (bot *Robot) SetMessagePreHandler(handles ...model.HandlePreSend)

func (*Robot) SetPostMessageHandler

func (bot *Robot) SetPostMessageHandler(handles ...model.HandlePostReply)

func (*Robot) Start

func (bot *Robot) Start(ctx context.Context) error

func (*Robot) Stop

func (bot *Robot) Stop()

Jump to

Keyboard shortcuts

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