bot

package module
v0.0.0-...-c12606d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MPL-2.0 Imports: 4 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 {
	// EnableUserWhitelist allows enabling a user-whitelist to restrict
	// bot-usage
	EnableUserWhitelist bool
	// contains filtered or unexported fields
}

func NewBot

func NewBot() *Bot

NewBot returns an empty but initialized bot

func (*Bot) Connect

func (b *Bot) Connect(host string, user, password string) error

Connect must be called in order to allow access to a server

func (*Bot) HelpHandler

func (b *Bot) HelpHandler(message, room, sender string)

HelpHandler autogenerates a short help-document.

func (*Bot) SendMessage

func (b *Bot) SendMessage(room, message string) error

func (*Bot) SendMessageHTML

func (b *Bot) SendMessageHTML(room, html, altText string) error

func (*Bot) SetCommand

func (b *Bot) SetCommand(command string, description string, handler HandlerFunc)

SetCommand allows specifying a handler for a command. The command may not contain spaces (commands with spaces will simply not work)

func (*Bot) UnsetCommand

func (b *Bot) UnsetCommand(command string)

UnsetCommand removes the specified command if it exists.

type HandlerFunc

type HandlerFunc func(parameter string, room string, sender string)

Handlerfunc defines the look of functions that may be used as a command-handler

Jump to

Keyboard shortcuts

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