serve

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(n int) (chan<- Payload, <-chan struct{})

New creates new channels for events queue and stopping any handling. A caller must close queue channel and waits stop one closing.

func Run

func Run(c *config.Config, p chan<- Payload, sigint <-chan os.Signal, logInfo, logError *log.Logger)

Run starts main service process.

Types

type HandlerType added in v1.3.0

type HandlerType func(context.Context, *cmd.Event) error

HandlerType is a type for command handler.

type Payload

type Payload struct {
	Cfg      *config.Config
	Event    *botgolang.Event
	LogInfo  *log.Logger
	LogError *log.Logger
}

Payload is a struct for events payload.

func (*Payload) ID

func (p *Payload) ID() string

ID returns message ID.

type SyncCommands added in v1.3.0

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

SyncCommands is a global map of chats which should be locked during command execution.

func NewSyncCommands added in v1.3.0

func NewSyncCommands(commands []string) *SyncCommands

func (*SyncCommands) Decorate added in v1.3.0

func (s *SyncCommands) Decorate(command, chat string, f HandlerType) HandlerType

Decorate returns a decorated function for the chat.

Jump to

Keyboard shortcuts

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