service

package
v2.13.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 0 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FanoutTrigger

func FanoutTrigger(id string, post Post)

func Init

func Init()

func RegisterServiceForTriggers

func RegisterServiceForTriggers(service Service)

func TriggerExists

func TriggerExists(id, server, groupID string) bool

Types

type Message

type Message interface {
	BotGroupID() string
	GroupID() string
	ServerID() string
	GroupName() string
	UserName() string
	UserID() string
	MessageID() string
	Text() string
	UserType() string
}

type Monitor

type Monitor interface {
	ValueFor(cachedID int) int
}

type Post

type Post struct {
	Key     string
	Text    string
	RawText string
	Type    PostType
	CacheID int
}

type PostType

type PostType int
const (
	PostTypeText PostType = iota
	PostTypeImage
	PostTypeURL
)

type Service

type Service interface {
	Post(post Post, groupMessage Message)
	ServiceMonitor() (Monitor, error)
	NoteProcessing(groupMessage Message)

	// Triggers
	ServiceTriggerWrangler() (TriggerWrangler, error)
}

type TriggerWrangler

type TriggerWrangler interface {
	EnableTrigger(id string, groupMessage Message)
	DisableTrigger(id string, groupMessage Message)
	IsTriggerConfiguredForGroup(id string, groupMessage Message) bool
	IsTriggerConfiguredForServer(id string, groupMessage Message) bool
	HandleTrigger(id string, post Post)
	HasTrigger(id, serverID, groupID string) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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