nullconn

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package nullconn holds a null connection that satisfies interfaces.Bot

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullConn

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

NullConn is an implementation of interfaces.Bot that is one giant no-op (with logging) Its good for testing or simply to use gggb as a management engine for games without the chat portions

func New

func New(l *log.Logger) *NullConn

New creates a new NullConn for use with a bot

func (*NullConn) AdminLevel

func (n *NullConn) AdminLevel(source string) int

AdminLevel returns the permission level that a given source has. It should return zero for sources with no permissions

func (*NullConn) Connect

func (n *NullConn) Connect() error

Connect connects to the service. It MUST NOT block after negotiation with the service is complete

func (*NullConn) Disconnect

func (n *NullConn) Disconnect(msg string)

Disconnect disconnects the bot from the service accepts a message for a reason, and should make Run return

func (*NullConn) HookJoin

func (n *NullConn) HookJoin(_ func(source, channel string))

HookJoin hooks on users joining a channel

func (*NullConn) HookKick

func (n *NullConn) HookKick(_ func(source, channel, target, message string))

HookKick hooks on a user being kicked from a channel

func (*NullConn) HookMessage

func (n *NullConn) HookMessage(_ func(source, channel, message string, isAction bool))

HookMessage hooks on messages to a channel

func (*NullConn) HookNick

func (n *NullConn) HookNick(_ func(source, newNick string))

HookNick hoops on a user changing their nickname

func (*NullConn) HookPart

func (n *NullConn) HookPart(_ func(source, channel, message string))

HookPart hooks on users leaving a channel

func (*NullConn) HookPrivateMessage

func (n *NullConn) HookPrivateMessage(_ func(source, channel, message string))

HookPrivateMessage hooks on messages to us directly

func (*NullConn) HookQuit

func (n *NullConn) HookQuit(_ func(source, message string))

HookQuit hooks on users disconnecting (for services that differentiate it from the above)

func (*NullConn) HumanReadableSource

func (n *NullConn) HumanReadableSource(source string) string

HumanReadableSource converts the given message source to one that is human readable

func (*NullConn) IsCommandPrefix

func (n *NullConn) IsCommandPrefix(l string) (string, bool)

IsCommandPrefix returns the given string and nothing else, as we dont implement it

func (*NullConn) JoinChannel

func (n *NullConn) JoinChannel(name string)

JoinChannel joins the given channel

func (*NullConn) Reload

func (n *NullConn) Reload(conf interfaces.Unmarshaler) error

Reload reloads the Bot using the given (string) config

func (*NullConn) Run

func (n *NullConn) Run() error

Run runs the bot, it should Connect() to the service and MUST block until connection is lost

func (*NullConn) SendAdminMessage

func (n *NullConn) SendAdminMessage(msg string)

SendAdminMessage sends the given message to the administrator

func (*NullConn) SendMessage

func (n *NullConn) SendMessage(target, msg string)

SendMessage sends a message to the given target

func (*NullConn) SendNotice

func (n *NullConn) SendNotice(target, msg string)

SendNotice sends a message that should not be responded to to the given target

func (*NullConn) SendRaw

func (n *NullConn) SendRaw(string)

SendRaw does exactly nothing.

func (*NullConn) StaticCommandPrefixes

func (n *NullConn) StaticCommandPrefixes() []string

StaticCommandPrefixes returns the bot's current command prefixes

func (*NullConn) Status

func (n *NullConn) Status() string

Status returns the status of the null config

Jump to

Keyboard shortcuts

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