Documentation ¶
Overview ¶
Package gumbleutil provides extras that can make working with gumble easier.
Index ¶
- Variables
- func CertificateLockFile(client *gumble.Client, filename string)
- func ChannelPath(channel *gumble.Channel) []string
- func Main(init func(client *gumble.Client), listener gumble.EventListener)
- func PlainText(tm *gumble.TextMessage) string
- type Listener
- func (l Listener) OnACL(e *gumble.ACLEvent)
- func (l Listener) OnBanList(e *gumble.BanListEvent)
- func (l Listener) OnChannelChange(e *gumble.ChannelChangeEvent)
- func (l Listener) OnConnect(e *gumble.ConnectEvent)
- func (l Listener) OnContextActionChange(e *gumble.ContextActionChangeEvent)
- func (l Listener) OnDisconnect(e *gumble.DisconnectEvent)
- func (l Listener) OnPermissionDenied(e *gumble.PermissionDeniedEvent)
- func (l Listener) OnServerConfig(e *gumble.ServerConfigEvent)
- func (l Listener) OnTextMessage(e *gumble.TextMessageEvent)
- func (l Listener) OnUserChange(e *gumble.UserChangeEvent)
- func (l Listener) OnUserList(e *gumble.UserListEvent)
- type ListenerFunc
- func (lf ListenerFunc) OnACL(e *gumble.ACLEvent)
- func (lf ListenerFunc) OnBanList(e *gumble.BanListEvent)
- func (lf ListenerFunc) OnChannelChange(e *gumble.ChannelChangeEvent)
- func (lf ListenerFunc) OnConnect(e *gumble.ConnectEvent)
- func (lf ListenerFunc) OnContextActionChange(e *gumble.ContextActionChangeEvent)
- func (lf ListenerFunc) OnDisconnect(e *gumble.DisconnectEvent)
- func (lf ListenerFunc) OnPermissionDenied(e *gumble.PermissionDeniedEvent)
- func (lf ListenerFunc) OnServerConfig(e *gumble.ServerConfigEvent)
- func (lf ListenerFunc) OnTextMessage(e *gumble.TextMessageEvent)
- func (lf ListenerFunc) OnUserChange(e *gumble.UserChangeEvent)
- func (lf ListenerFunc) OnUserList(e *gumble.UserListEvent)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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) 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.