irccommand

package
v0.0.0-...-df918ef Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: ISC Imports: 5 Imported by: 1

Documentation

Overview

Package irccommand provides an event.Handler implementation scoped to IRC commands

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler implements a IRC command based event system (and is an implementation of event.MessageHandler)

func (*Handler) AddCallback

func (h *Handler) AddCallback(command string, callback event.CallbackFunc) int

AddCallback adds a callback to the given command name. The returned ID can be used to remove the callback the special command name * will collect calls for any command. Similar to the raw handler

func (*Handler) OnMessage

func (h *Handler) OnMessage(msg *event.Message) error

OnMessage implements the MessageHandler interface

func (*Handler) RemoveCallback

func (h *Handler) RemoveCallback(id int)

RemoveCallback remove a callback from the Handler instance

func (*Handler) WaitFor

func (h *Handler) WaitFor(command string) <-chan *event.Message

WaitFor waits until the specified command is returned by the server

type SimpleHandler

type SimpleHandler struct {
	*Handler
}

SimpleHandler is a wrapper around Handler that works with the raw ircmsg.Message directly.

func (*SimpleHandler) AddCallback

func (h *SimpleHandler) AddCallback(command string, callback func(*ircmsg.Message) error) int

AddCallback adds a callback to the SimpleHandler instance

func (*SimpleHandler) OnMessage

func (h *SimpleHandler) OnMessage(msg *event.Message) error

OnMessage calls Handler.OnMessage

func (*SimpleHandler) RemoveCallback

func (h *SimpleHandler) RemoveCallback(id int)

RemoveCallback calls Handler.RemoveCallback

func (*SimpleHandler) WaitFor

func (h *SimpleHandler) WaitFor(command string) <-chan *ircmsg.Message

WaitFor waits for the specified IRC command, and sends the

Jump to

Keyboard shortcuts

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