worker

package
v0.1.4-alpha-deployment1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscordWorker

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

func NewWorker

func NewWorker(
	db *sqlx.DB,
	rc *redis.Client,
	session *discordgo.Session,
	cmdst commandst.CommandsSender,
	logger *zap.Logger,
) *DiscordWorker

NewWorker creates a new discord worker service

func (*DiscordWorker) AddCommandWorker

func (d *DiscordWorker) AddCommandWorker(command, queue string)

func (*DiscordWorker) OnMessageHandler

func (d *DiscordWorker) OnMessageHandler()

OnMessageHandler ...

func (*DiscordWorker) Open

func (d *DiscordWorker) Open() error

type EventRegistrar

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

EventRegistrar contains events and subscribes observers on events

func NewEventRegistrar

func NewEventRegistrar(logger *zap.Logger) *EventRegistrar

NewEventRegistrar creates a new EventRegistrar

func (*EventRegistrar) Notify

func (er *EventRegistrar) Notify(event string, message MessageEvent)

Notify triggers the event observer

func (*EventRegistrar) Register

func (er *EventRegistrar) Register(event string, observer Observer)

Register create new event observer and register observer

type MessageEvent

type MessageEvent struct {
	GuildID   string
	UserID    string
	ChannelID string
	Username  string
	Message   string
}

type Observer

type Observer interface {
	Notify(e *MessageEvent)
}

type RabbitCommandObserver

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

func NewRabbitCommandObserver

func NewRabbitCommandObserver(queue string, cmdSender commandst.CommandsSender, logger *zap.Logger) *RabbitCommandObserver

func (*RabbitCommandObserver) GetId

func (r *RabbitCommandObserver) GetId() uuid.UUID

func (*RabbitCommandObserver) Notify

func (r *RabbitCommandObserver) Notify(e *MessageEvent)

Jump to

Keyboard shortcuts

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