remote

package
v0.0.0-...-38c0829 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Name

func Name(c context.Context) string

Name returns the name of the remote.

func Reaction

func Reaction(c context.Context, message models.Message, rule models.Rule, bot *models.Bot)

Reaction enables the bot to add emoji reactions to messages.

func Read

func Read(c context.Context, inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot)

Read enables the bot to read messages from a remote.

func Send

func Send(c context.Context, message models.Message, bot *models.Bot)

Send enables the bot to send messages to a remote.

Types

type Remote

type Remote interface {
	Reaction(message models.Message, rule models.Rule, bot *models.Bot)

	Read(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot)

	Send(message models.Message, bot *models.Bot)

	Name() string
}

Remote - this interface allows us to keep the bot "remote agnostic" meaning that the bot should not care about what specific remote (e.g. Slack or Discord) it is reading/sending messages from. It is up to the developer to implement the details of how messages should be read/sent in the specific package for the remote (e.g. see '/remote/slack/remote.go') Each remote will share generic functions as seen below that will be evoked by the bot (e.g. see '/core/remotes.go' or '/core/outputs.go'), and each function will be implemented in detail within its specific remote package.

func FromContext

func FromContext(c context.Context) Remote

FromContext returns the Remote associated with this context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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