plugins

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: EUPL-1.2 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MessagePluginData string = "MessagePlugin"

Variables

This section is empty.

Functions

func DefaultPlugins

func DefaultPlugins() []akevitt.Plugin

func LoginScreen

func LoginScreen(engine *akevitt.Akevitt, session *akevitt.ActiveSession, nextScreen akevitt.UIFunc) tview.Primitive

func NewHelpPlugin added in v0.3.5

func NewHelpPlugin() *helpPluginBuilder

func RegistrationScreen

func RegistrationScreen(engine *akevitt.Akevitt, session *akevitt.ActiveSession, nextScreen akevitt.UIFunc) tview.Primitive

Types

type AccountPlugin

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

func NewAccountPlugin

func NewAccountPlugin() *AccountPlugin

func (*AccountPlugin) Build

func (plugin *AccountPlugin) Build(engine *akevitt.Akevitt) error

func (*AccountPlugin) LoginSession

func (plugin *AccountPlugin) LoginSession(username, password string, session *akevitt.ActiveSession) error

func (*AccountPlugin) Register

func (plugin *AccountPlugin) Register(username, password, repeatPassword string, session *akevitt.ActiveSession) error

type BoltDbPlugin

type BoltDbPlugin[T akevitt.Object] struct {
	// contains filtered or unexported fields
}

func NewBoltPlugin

func NewBoltPlugin[T akevitt.Object](path string) *BoltDbPlugin[T]

func (*BoltDbPlugin[T]) Build

func (plugin *BoltDbPlugin[T]) Build(engine *akevitt.Akevitt) error

func (*BoltDbPlugin[T]) LoadAll

func (plugin *BoltDbPlugin[T]) LoadAll() ([]T, error)

func (*BoltDbPlugin[T]) Save

func (plugin *BoltDbPlugin[T]) Save(object T) error

type Dialogue

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

Dialogue struct for creating dialogue-like events. The content is actually a UI element, so you implement merchants, dialogues, etc. You must call NewDialogue to get started.

func (*Dialogue) AddOption

func (dial *Dialogue) AddOption(title string, content tview.Primitive) *Dialogue

Add options to the dialogue

func (*Dialogue) End

func (dial *Dialogue) End(text string) *Dialogue

Ends the dialogue with "Close" option

func (*Dialogue) GetContents

func (dial *Dialogue) GetContents() tview.Primitive

Gets the UI of dialogue

func (*Dialogue) GetOptions

func (dial *Dialogue) GetOptions() []*Dialogue

Gets an array of options

func (*Dialogue) GetTitle

func (dial *Dialogue) GetTitle() string

Gets title of an option

func (*Dialogue) Proceed

func (dial *Dialogue) Proceed(index int, session *akevitt.ActiveSession, plugin *DialoguePlugin) error

Invokes engine.Dialogue of the specified index from options.

func (*Dialogue) SetContent

func (dial *Dialogue) SetContent(content tview.Primitive) *Dialogue

Accepts UI element to be displayed on user.

type DialogueFunc

type DialogueFunc = func(engine *akevitt.Akevitt, session *akevitt.ActiveSession, dialogue *Dialogue) error

type DialoguePlugin

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

func NewDialoguePlugin

func NewDialoguePlugin(fn DialogueFunc) *DialoguePlugin

func (*DialoguePlugin) Build

func (plugin *DialoguePlugin) Build(engine *akevitt.Akevitt) error

func (*DialoguePlugin) Dialogue

func (plugin *DialoguePlugin) Dialogue(dialogue *Dialogue, session *akevitt.ActiveSession) error

Invokes dialogue event. Make sure you have installed the hook during initalisation.

func (*DialoguePlugin) NewDialogue

func (*DialoguePlugin) NewDialogue(title string) *Dialogue

Creates new instance of dialogue

type Doc added in v0.3.5

type Doc struct {
	Long  string
	Brief string
}

type HeartBeatsPlugin

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

func (*HeartBeatsPlugin) Build

func (plugin *HeartBeatsPlugin) Build(engine *akevitt.Akevitt) error

func (*HeartBeatsPlugin) SubscribeToHeartBeat

func (plugin *HeartBeatsPlugin) SubscribeToHeartBeat(interval time.Duration, fn func() error) error

type HeartBuilder

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

func NewHeartbeatPlugin

func NewHeartbeatPlugin() *HeartBuilder

func (*HeartBuilder) Finish

func (builder *HeartBuilder) Finish() *HeartBeatsPlugin

func (*HeartBuilder) NewDuration

func (builder *HeartBuilder) NewDuration(duration time.Duration) *HeartBuilder

type HeartbeatMap

type HeartbeatMap = map[time.Duration]*akevitt.Pair[time.Ticker, []func() error]

type HelpPlugin added in v0.3.5

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

func (*HelpPlugin) Build added in v0.3.5

func (plugin *HelpPlugin) Build(engine *akevitt.Akevitt) error

func (*HelpPlugin) FindHelp added in v0.3.5

func (plugin *HelpPlugin) FindHelp(command string) (string, error)

func (*HelpPlugin) ListHelp added in v0.3.5

func (plugin *HelpPlugin) ListHelp() string

func (*HelpPlugin) ListHelpCustom added in v0.3.5

func (plugin *HelpPlugin) ListHelpCustom(callback func(string, Doc) string) string

type MessageFunc

type MessageFunc = func(engine *akevitt.Akevitt, session *akevitt.ActiveSession, channel, message, username string) error

type MessagePlugin

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

func NewMessagePlugin

func NewMessagePlugin(includeCmd bool, fn MessageFunc, format string) *MessagePlugin

func (*MessagePlugin) AddChannel added in v0.3.5

func (plugin *MessagePlugin) AddChannel(channel string, session *akevitt.ActiveSession)

func (*MessagePlugin) Build

func (plugin *MessagePlugin) Build(engine *akevitt.Akevitt) error

func (*MessagePlugin) GetChatLog

func (plugin *MessagePlugin) GetChatLog(session *akevitt.ActiveSession) *tview.TextView

func (*MessagePlugin) Message

func (plugin *MessagePlugin) Message(engine *akevitt.Akevitt, channel, message, username string, session *akevitt.ActiveSession) error

Send the message to other current sessions

func (*MessagePlugin) RemoveChannel added in v0.3.5

func (plugin *MessagePlugin) RemoveChannel(channel string, session *akevitt.ActiveSession)

func (*MessagePlugin) UpdateChannel

func (plugin *MessagePlugin) UpdateChannel(old, new string, session *akevitt.ActiveSession)

Jump to

Keyboard shortcuts

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