bot

package
v0.0.0-...-6e7897a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Sync bool
	// contains filtered or unexported fields
}

Bot hold the bot state

func New

func New(e Engine) *Bot

Instantiate a new bot using the provided engine

func (*Bot) HandleMessage

func (bot *Bot) HandleMessage(m *xmpp.Message)

HandleMessage handles incoming XMPP messages

func (*Bot) HandleStanza

func (bot *Bot) HandleStanza(s xmpp.Stanza)

HandleStanza handles incoming XMPP stanzas

func (*Bot) Offline

func (bot *Bot) Offline(err error)

Offline is invoked when the XMPP session ends

func (*Bot) Online

func (bot *Bot) Online(s xmppc.Session)

Online is invoked when a new XMPP session is established

func (*Bot) Send

func (bot *Bot) Send(jid xmpp.JID, format string, a ...interface{}) error

Send a formatted message to a JID

type ChatWriter

type ChatWriter interface {
	Send(xmpp.JID, string, ...interface{}) error
}

type Context

type Context struct {
	Sender xmpp.JID
	// contains filtered or unexported fields
}

Context stores information about messages's context

func (*Context) Reply

func (ctx *Context) Reply(format string, a ...interface{}) error

Reply sends back a reply

type Engine

type Engine interface {
	Online(writer ChatWriter)
	Offline(error)
}

Engine represents a bot engine

Jump to

Keyboard shortcuts

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