gumbleutil

package
v0.0.0-...-add2d34 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: GPL-3.0, MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gumbleutil provides extras that can make working with gumble easier.

Index

Constants

This section is empty.

Variables

View Source
var AutoBitrate gumble.EventListener

AutoBitrate is a gumble.EventListener that automatically sets the client's AudioDataBytes to suitable value, based on the server's bitrate.

Functions

func CertificateLockFile

func CertificateLockFile(client *gumble.Client, filename string)

CertificateLockFile adds a new certificate lock on the given Client that ensures that a server's certificate chain is the same from connection-to-connection. This is helpful when connecting to servers with self-signed certificates.

If filename does not exist, the server's certificate chain will be written to that file. If it does exist, certificates will be read from the file and checked against the server's certificate chain upon connection.

Example:

if allowSelfSignedCertificates {
    config.TLSConfig.InsecureSkipVerify = true
}
gumbleutil.CertificateLockFile(client, filename)

if err := client.Connect(); err != nil {
    panic(err)
}

func ChannelPath

func ChannelPath(channel *gumble.Channel) []string

ChannelPath returns a slice of channel names, starting from the root channel to the given channel.

func Main

func Main(init func(client *gumble.Client), listener gumble.EventListener)

Main aids in the creation of a basic command line gumble bot. It accepts the following flag arguments: --server, --username, --password, --insecure, --certificate, and --key.

If init is non-nil, it is called before attempting to connect to the server.

func PlainText

func PlainText(tm *gumble.TextMessage) string

PlainText returns the Message string without HTML tags or entities.

Types

type Listener

type Listener struct {
	Connect             func(e *gumble.ConnectEvent)
	Disconnect          func(e *gumble.DisconnectEvent)
	TextMessage         func(e *gumble.TextMessageEvent)
	UserChange          func(e *gumble.UserChangeEvent)
	ChannelChange       func(e *gumble.ChannelChangeEvent)
	PermissionDenied    func(e *gumble.PermissionDeniedEvent)
	UserList            func(e *gumble.UserListEvent)
	ACL                 func(e *gumble.ACLEvent)
	BanList             func(e *gumble.BanListEvent)
	ContextActionChange func(e *gumble.ContextActionChangeEvent)
	ServerConfig        func(e *gumble.ServerConfigEvent)
}

Listener is a struct that implements the gumble.EventListener interface. The corresponding event function in the struct is called if it is non-nil.

func (Listener) OnACL

func (l Listener) OnACL(e *gumble.ACLEvent)

OnACL implements gumble.EventListener.OnACL.

func (Listener) OnBanList

func (l Listener) OnBanList(e *gumble.BanListEvent)

OnBanList implements gumble.EventListener.OnBanList.

func (Listener) OnChannelChange

func (l Listener) OnChannelChange(e *gumble.ChannelChangeEvent)

OnChannelChange implements gumble.EventListener.OnChannelChange.

func (Listener) OnConnect

func (l Listener) OnConnect(e *gumble.ConnectEvent)

OnConnect implements gumble.EventListener.OnConnect.

func (Listener) OnContextActionChange

func (l Listener) OnContextActionChange(e *gumble.ContextActionChangeEvent)

OnContextActionChange implements gumble.EventListener.OnContextActionChange.

func (Listener) OnDisconnect

func (l Listener) OnDisconnect(e *gumble.DisconnectEvent)

OnDisconnect implements gumble.EventListener.OnDisconnect.

func (Listener) OnPermissionDenied

func (l Listener) OnPermissionDenied(e *gumble.PermissionDeniedEvent)

OnPermissionDenied implements gumble.EventListener.OnPermissionDenied.

func (Listener) OnServerConfig

func (l Listener) OnServerConfig(e *gumble.ServerConfigEvent)

OnServerConfig implements gumble.EventListener.OnServerConfig.

func (Listener) OnTextMessage

func (l Listener) OnTextMessage(e *gumble.TextMessageEvent)

OnTextMessage implements gumble.EventListener.OnTextMessage.

func (Listener) OnUserChange

func (l Listener) OnUserChange(e *gumble.UserChangeEvent)

OnUserChange implements gumble.EventListener.OnUserChange.

func (Listener) OnUserList

func (l Listener) OnUserList(e *gumble.UserListEvent)

OnUserList implements gumble.EventListener.OnUserList.

type ListenerFunc

type ListenerFunc func(e interface{})

ListenerFunc is a single listener function that implements the gumble.EventListener interface. This is useful if you would like to use a type-switch for handling the different event types.

Example:

handler := func(e interface{}) {
  switch e.(type) {
  case *gumble.ConnectEvent:
    println("Connected")
  case *gumble.DisconnectEvent:
    println("Disconnected")
  // ...
  }
}

client.Attach(gumbleutil.ListenerFunc(handler))

func (ListenerFunc) OnACL

func (lf ListenerFunc) OnACL(e *gumble.ACLEvent)

OnACL implements gumble.EventListener.OnACL.

func (ListenerFunc) OnBanList

func (lf ListenerFunc) OnBanList(e *gumble.BanListEvent)

OnBanList implements gumble.EventListener.OnBanList.

func (ListenerFunc) OnChannelChange

func (lf ListenerFunc) OnChannelChange(e *gumble.ChannelChangeEvent)

OnChannelChange implements gumble.EventListener.OnChannelChange.

func (ListenerFunc) OnConnect

func (lf ListenerFunc) OnConnect(e *gumble.ConnectEvent)

OnConnect implements gumble.EventListener.OnConnect.

func (ListenerFunc) OnContextActionChange

func (lf ListenerFunc) OnContextActionChange(e *gumble.ContextActionChangeEvent)

OnContextActionChange implements gumble.EventListener.OnContextActionChange.

func (ListenerFunc) OnDisconnect

func (lf ListenerFunc) OnDisconnect(e *gumble.DisconnectEvent)

OnDisconnect implements gumble.EventListener.OnDisconnect.

func (ListenerFunc) OnPermissionDenied

func (lf ListenerFunc) OnPermissionDenied(e *gumble.PermissionDeniedEvent)

OnPermissionDenied implements gumble.EventListener.OnPermissionDenied.

func (ListenerFunc) OnServerConfig

func (lf ListenerFunc) OnServerConfig(e *gumble.ServerConfigEvent)

OnServerConfig implements gumble.EventListener.OnServerConfig.

func (ListenerFunc) OnTextMessage

func (lf ListenerFunc) OnTextMessage(e *gumble.TextMessageEvent)

OnTextMessage implements gumble.EventListener.OnTextMessage.

func (ListenerFunc) OnUserChange

func (lf ListenerFunc) OnUserChange(e *gumble.UserChangeEvent)

OnUserChange implements gumble.EventListener.OnUserChange.

func (ListenerFunc) OnUserList

func (lf ListenerFunc) OnUserList(e *gumble.UserListEvent)

OnUserList implements gumble.EventListener.OnUserList.

Jump to

Keyboard shortcuts

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