berghandler

package
v0.0.0-...-220f456 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const WrongArguments = "Falsche Anzahl an Argumenten, benutze %v help für Hilfe."

Variables

View Source
var CommandPrefix = "!"

Functions

func IsMessagewithPrefix

func IsMessagewithPrefix(evt *event.Event, prefix string) bool

func RemoveWord

func RemoveWord(slice []string, s int) []string

func SendFormattedMessage

func SendFormattedMessage(he HandlerEssentials, evt *event.Event, handlerName, msg string) bool

func SendMessage

func SendMessage(he HandlerEssentials, evt *event.Event, handlerName, msg string) bool

func SetCommandPrefix

func SetCommandPrefix(prefix string)

func SplitAnswer

func SplitAnswer(words []string, RequiredCount, OptionalCount int, vars ...*string) error

func StripPrefix

func StripPrefix(message, prefix string) string

func StripPrefixandGetContent

func StripPrefixandGetContent(message, prefix string) ([]string, error)

Types

type BergEventHandleFunction

type BergEventHandleFunction func(he HandlerEssentials, evt *event.Event, words []string, neededVariables, optionalVariables int) bool

type BergEventHandler

type BergEventHandler interface {
	Handle(he HandlerEssentials, source mautrix.EventSource, evt *event.Event) bool
	GetName() string
	GetCommand() string
	Prime(he HandlerEssentials) error
}

type HandlerEssentials

type HandlerEssentials struct {
	Client  *mautrix.Client
	Logger  *zap.SugaredLogger
	Storage *storage.Manager
}

type SubHandlerSet

type SubHandlerSet struct {
	F  BergEventHandleFunction //Function
	H  string                  //Helptext
	U  string                  //USagetext
	NV int                     //Needed Variable Count
	OV int                     //Optional Variable Count
}

type SubHandlers

type SubHandlers map[string]SubHandlerSet

func (*SubHandlers) Handle

func (s *SubHandlers) Handle(command string, handlerName string, he HandlerEssentials, evt *event.Event) bool

Jump to

Keyboard shortcuts

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