gumbleutil

package
v0.0.0-...-4d3bd5a Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: GPL-2.0, MPL-2.0 Imports: 11 Imported by: 2

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 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(listeners ...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
--key

func PlainText

func PlainText(tm *gumble.TextMessage) string

PlainText returns the Message string without HTML tags or entities.

func UserGroups

func UserGroups(client *gumble.Client, user *gumble.User, channel *gumble.Channel) <-chan []string

UserGroups fetches the group names the given user belongs to in the given channel. The slice of group names sent via the returned channel. On error, the returned channel is closed without without sending a slice.

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