piepan v0.10.0
usage: piepan [options] [script files]
an easy to use framework for writing Mumble bots using Lua
-access-token value
server access token (can be defined multiple times) (default [])
-certificate string
user certificate file (PEM)
-ffmpeg string
ffmpeg-capable executable for media streaming (default "ffmpeg")
-insecure
skip certificate checking
-key string
user certificate key file (PEM)
-password string
user password
-script-args value
script arguments for lua from the command line
-server string
address of the server (default "localhost:64738")
-username string
username of the bot (default "piepan-bot")
- Install dependencies
- Base dependencies
- Download and run Go installer
- Download and run MSYS2 installer
- Uncheck "Run MSYS2 32/64bit now"
- Open the MSYS2 "MinGW-w64 Win32/64 Shell" from the start menu to install additional dependencies
- 32-bit:
pacman -Syy mingw-w64-i686-toolchain git mingw-w64-i686-opus pkg-config mingw-w64-i686-ffmpeg
- 64-bit:
pacman -Syy mingw-w64-x86_64-toolchain git mingw-w64-x86_64-opus pkg-config mingw-w64-x86_64-ffmpeg
- 32-bit:
- Base dependencies
- Create a GOPATH (skip if you already have a GOPATH you want to use)
export GOPATH=$(mktemp -d)
- Configure environment for building Opus
export CGO_LDFLAGS="$(pkg-config --libs opus)"
export CGO_CFLAGS="$(pkg-config --cflags opus)"
- Fetch piepan
go get -tags nopkgconfig -u layeh.com/piepan
- Build piepan
go build -o piepan.exe $GOPATH/src/layeh.com/piepan/cmd/piepan/main.go
- Run piepan
./piepan.exe -ffmpeg=ffmpeg.exe ...
- Install dependencies
- Base dependencies
sudo apt-get install -y git libopus-dev wget python-software-properties software-properties-common pkg-config gcc libav-tools
- Go
sudo add-apt-repository -y ppa:evarlast/golang1.4
sudo apt-get update
sudo apt-get install -y golang
- Create a GOPATH (skip if you already have a GOPATH you want to use)
export GOPATH=$(mktemp -d)
- Fetch piepan
go get -u layeh.com/piepan
- Build piepan
go build -o piepan $GOPATH/src/layeh.com/piepan/cmd/piepan/main.go
- Run piepan with
avconv
./piepan -ffmpeg=avconv ...
piepan is built using the gumble library. Documentation for types not part of piepan itself (including User and Channel) can be found in the gumble documentation.
-
VoiceTarget
NewTarget(int id)
: Create a new voice target object. -
piepan.AudioStream New(table obj)
: Returns a new AudioStream. The following modes are supported:- Filename:
- Plays the media file
obj.filename
.
- Plays the media file
- Pipe:
- Uses the output of the program
obj.exec
executed withobj.args
.
- Uses the output of the program
obj.offset
defines the number of seconds from the beginning of the stream to starting playing at.
obj.callback
can be defined as a function that is called after the playback has completed. If audio has been paused - Filename:
-
piepan.AudioStream Current()
: Returns the currently playing stream. -
void SetTarget(VoiceTarget target)
sets the target for the new audio stream that is played. Calling this function with no arguments removes any voice targeting. -
int Bitrate()
: Returns the bitrate of the audio encoder. -
void SetBitrate(int bitrate)
: Sets the bitrate of the audio encoder. Calling this function will override the automatically-configured, optimal bitrate. -
bool IsPlaying()
: Returns if there is a stream currently playing.
Note: after an audio stream has stopped/completed, it cannot be started again.
void Play()
: Starts playing or resumes the audio stream. An error is thrown if the stream cannot be started, usually due to a missing ffmpeg executable.void Stop()
: Stops a playing or paused stream.void Pause()
: Pauses the playing stream.void IsPlaying()
: Returns if the stream is playing.void IsPaused()
: Returns if the stream is paused.void IsStopped()
: Returns if the stream has stopped.float Elapsed()
: Returns the amount of audio (in seconds) that the stream played.void SetVolume(float volume)
: Sets the volume of transmitted audio (default: 1.0).float Volume()
: Returns the stream's volume.
Channels
piepan.Channels
Object that contains all of the channels that are on the server. The channels are mapped by their channel IDs. piepan.Channels[0]
is the server's root channel.
Disconnects from the server.
Registers an event listener for a given event type. The follow events are currently supported:
connect
(Arguments:ConnectEvent event
)- Called when connection to the server has been made. This is where a script should perform its initialization.
disconnect
(Arguments:DisconnectEvent event
)- Called when connection to the server has been lost or after
piepan.Disconnect()
is called.
- Called when connection to the server has been lost or after
message
(Arguments:TextMessageEvent event
)- Called when a text message is received.
userChange
(Arguments:UserChangeEvent event
)- Called when a user's properties changes (e.g. connects to the server).
channelChange
(Arguments:ChannelChangeEvent event
)- Called when a channel changes state (e.g. is added or removed).
permissionDenied
(Arguments:PermissionDeniedEvent event
)- Called when a requested action could not be performed.
stream
(Arguments:piepan.AudioStream
)- Called when a stream changes state (plays, pauses, or stops).
Note: events with a Type
field have slight changes than what is documented in gumble:
- The
Type
field is changed to a number. - Individual bit flag values are added to the event as booleans prefixed with
Is
DisconnectEvent
IsError
IsUser
UserChangeEvent
IsConnected
IsDisconnected
IsKicked
IsBanned
IsRegistered
IsUnregistered
IsChangeName
IsChangeChannel
IsChangeComment
IsChangeAudio
IsChangeTexture
IsChangePrioritySpeaker
IsChangeRecording
ChannelChangeEvent
IsCreated
IsRemoved
IsMoved
IsChangeName
IsChangeDescription
IsChangePosition
PermissionDeniedEvent
IsOther
IsPermission
IsSuperUser
IsInvalidChannelName
IsTextTooLong
IsTemporaryChannel
IsMissingCertificate
IsInvalidUserName
IsChannelFull
IsNestingLimit
-
piepan.Process New(function callback, string command, string arguments...)
: Executescommand
in a new process with the given arguments. The functioncallback
is executed once the process has completed, passing if the execution was successful and the contents of standard output. -
void Kill()
: Kills the process.
User
piepan.Self
The User
object that references yourself.
-
piepan.Timer New(function callback, int timeout)
: Creates a new timer. After at leasttimeout
milliseconds,callback
will be executed. -
void Cancel()
: Cancels the timer.
Users
piepan.Users
Object containing each connected user on the server, with the keys being the session ID of the user and the value being their corresponding piepan.User
table.
piepan.Args
: features arguments passed to piepan via the-script-args
flag as an array. 0 or more-script-args
may be included
- 0.10.0 (Next)
- Remove -lock flag
- Server connection rejection is now earlier in the lifecycle
- Change exit codes
- Added
-script-args
which surfaces in lua aspiepan.Args
- 0.9.0 (2016-01-15)
- Add "stream" event.
- Fix
piepan.Timer.New
not being exposed
- 0.8.1 (2015-12-16)
- Fix -ffmpeg flag not being used
AudioStream.Play
now throws an error if the stream cannot be started
- 0.8.0 (2015-12-11)
- Switch to stream-based audio. Individual audios streams can be created then played, paused, and stopped.
- Add
gumble.ConnectEvent
wrapper - Add pipe support to
piepan.Audio.New
- Add
offset
field topiepan.Audio.New
's argument - Remove all plugins; piepan is Lua only
- 0.7.0 (2015-04-08)
- Add additional Lua support via gopher-lua
- Add access token flag
- Non-script-invoked disconnections are reported though the exit status
- Remove
-servername
flag (-lock
+-insecure
should be used instead) - JavaScript plugin:
piepan.Users
andpiepan.Channels
are no longer mapped using string keys (otto needs to be updated before building)
- 0.6.0 (2015-02-11)
- Fixes due to gumble API changes (see the gumble API if your scripts are not working).
- Fix crash if
piepan.Process.New
executable did not exist
- 0.5.0 (2015-02-08)
- Moved to plugin-based system
- Add certificate locking
- Add bitrate, volume functions to piepan.Audio
- Add auto bitrate setting
- Add Lua plugin
- Add
piepan.File
to JavaScript plugin - Voice targeting is more like the gumble API
- 0.4.0 (2014-12-11)
- Moved to Go (+ gumble)
- API has been overhauled. There is no backwards capability with previous versions of piepan
- JavaScript is now being used as the scripting language
- 0.3.1 (2014-10-06)
- Fixed audio transmission memory leak
- 0.3.0 (2014-10-01)
- Removed
data
argument fromChannel.play
andTimer.new
- Fixed inability to start playing audio from inside of an audio completion callback
- Removed
- 0.2.0 (2014-09-15)
- Added support for fetching large channel descriptions, user textures/avatars, and user comments
- Added
piepan.server.maxMessageLength
,piepan.server.maxImageMessageLength
- Added
piepan.onPermissionDenied()
,piepan.Permissions
,piepan.PermissionDenied
,piepan.User.hash
,piepan.User.setComment()
,piepan.User.register()
,piepan.User.setTexture()
,piepan.User.isPrioritySpeaker
,piepan.Channel.remove()
,piepan.Channel.setDescription()
UserChange
andChannelChange
are no longer hidden- Added audio file support
- Each script is now loaded in its own Lua environment, preventing global variable interference between scripts
- Fixed
piepan.User.userId
not being filled - Multiple instances of the same script can now be run at the same time
- Command line option
-pw
was renamed to-p
. The old functionality of-p
was moved to the-h
option, by using the newhost:port
syntax
- 0.1.1 (2013-12-15)
- Fixed bug where event loop would stop when a packet with length zero was received
sendPacket
now properly accepts a version packet
- 0.1 (2013-12-11)
- Initial Release
MPL 2.0
Author: Tim Cooper <[email protected]>