Properties

$uuid

$uuid : string

UUID stores the SinusBot Instance UUID

Type

string

$timeout

$timeout : integer

Timeout represents the HTTP timeout when HTTP requests to the SinusBot API are performed

Type

integer

$token

$token : string

Token is the SinusBot auth token which will be there temporary stored.

Type

string

$url

$url : string

URL is the SinusBot URL with the port and the HTTP protocol

Type

string

$headers

$headers : array

headers are http headers which will be added on every request

Type

array

$instance

$instance : array

Instance stores the initial received instance data

Type

array

Methods

__construct()

__construct(\SinusBot\API  $api, array  $instance) : void

__construct

Parameters

\SinusBot\API $api

SinusBot API

array $instance

SinusBot Instance array

addHeader()

addHeader(string  $key, string  $value) 

addHeader adds a header to every http request

Parameters

string $key

http header key

string $value

http header value

setAuthToken()

setAuthToken(string  $token) 

setAuthToken overrides the auth token

Parameters

string $token

Auth-Token, when you want to override

isPlaying()

isPlaying() : boolean

isPlaying returns true when the instance is playing something

Returns

boolean

isRunning()

isRunning() : boolean

isRunning returns true when the instance is running

Returns

boolean

getBackend()

getBackend() : string

getBackend returns the SinusBot backend (Discord, TS³)

Returns

string —

instance backend

getNick()

getNick() : string

getNick returns the Bot's nickname

Returns

string —

nick

getName()

getName() : string

getName returns the Bot's name

Returns

string —

name

getServerHost()

getServerHost() : string

getServerHost returns the Bot's server host

Returns

string —

host

getServerPort()

getServerPort() : string

getServerPort returns the Bot's server port

Returns

string —

port

delete()

delete() : array

delete deletes the instance

Returns

array —

status

spawn()

spawn() : array

spawn spawns the instance

Returns

array —

status

respawn()

respawn() : array

respawn restarts the instance

Returns

array —

status

kill()

kill() : array

kill kills the instance

Returns

array —

status

getWebStream()

getWebStream() : string

getWebStream returns the webstream URL of the instance

requires: EnableWebStream = true

Returns

string —

url (opus-encoded-ogg-stream)

getWebStreamToken()

getWebStreamToken() : string

getWebStreamToken returns the webstream token

requires: EnableWebStream = true

Returns

string —

token

getVolume()

getVolume() : integer

getVolume returns the current volume

Returns

integer

setVolume()

setVolume(string  $volume = 50) : array

setVolume sets the volume to a given one

Parameters

string $volume

{0-100}

Returns

array —

status

setVolumeUp()

setVolumeUp() : array

setVolumeUp increases the volume by 5

Returns

array —

status

setVolumeDown()

setVolumeDown() : array

setVolumeDown reduces the volume by 5

Returns

array —

status

getStatus()

getStatus() : array

getStatus returns the current instance status

Returns

array —

status

getLog()

getLog() : array

getLog returns the instance log

Returns

array —

log

getSettings()

getSettings() : array

getSettings returns the instance settings

Returns

array —

users

setSettings()

setSettings(array  $data) : array

setSettings updates the instance settings

Parameters

array $data

array of properties

Returns

array —

status

getChannels()

getChannels() : array

getChannels returns the channels of the connected TS³ or Discord server

Returns

array —

channels

uploadAvatar()

uploadAvatar(string  $path) : array

uploadAvatar uploads a avatar from a local file

Parameters

string $path

/var/www/image.jpg

Returns

array —

status

deleteAvatar()

deleteAvatar() : array

deleteAvatar deletes the current avatar

Returns

array —

status

getQueueTracks()

getQueueTracks() : array

getQueueTracks returns the tracks in the queue

Returns

array —

files

appendQueueTrack()

appendQueueTrack(string  $trackUUID) : array

appendQueueTrack adds a track to the queue

Parameters

string $trackUUID

uuid of the track

Returns

array —

status

prependQueueTrack()

prependQueueTrack(string  $trackUUID) : array

prependQueueTrack adds a track to the beginning of the queue

Parameters

string $trackUUID

track uuid

Returns

array —

status

deleteQueueTrack()

deleteQueueTrack(integer  $trackPosition) : array

deleteQueueTrack deletes a track in the queue

Parameters

integer $trackPosition

first entry = 0

Returns

array —

status

deleteQueueTracks()

deleteQueueTracks() : array

deleteQueueTracks deletes all the tracks in the queue

Returns

array —

status

say()

say(string  $text, string  $locale) : array

say will say the given text via the tts

Parameters

string $text

Welcome

string $locale

en

Returns

array —

status

playTrack()

playTrack(string  $trackUUID) : array

playTrack will play the given track

Parameters

string $trackUUID

UUID of the track

Returns

array —

status

playURL()

playURL(string  $url) : array

playURL will play the given URL

Parameters

string $url

stream url

Returns

array —

status

playPlaylist()

playPlaylist(string  $playlistUUID, string  $playlistIndex) : array

playPlaylist will play the given playlist

Parameters

string $playlistUUID

uuid of a playlist

string $playlistIndex

0

Returns

array —

status

playPrevious()

playPrevious() : array

playPrevious will play the previous track

Returns

array —

status

playNext()

playNext() : array

playNext will play the next track

Returns

array —

status

playRepeat()

playRepeat(integer  $repeatState = 1) : array

playRepeat enables the play repeat

Parameters

integer $repeatState

{0=disable,1=enable}

Returns

array —

status

playShuffle()

playShuffle(integer  $shuffleState = 1) : array

playShuffle enables the shuffly functionality

Parameters

integer $shuffleState

{0=disable,1=enable}

Returns

array —

status

stop()

stop() : array

stop stops the playback

Returns

array —

status

seekPlayback()

seekPlayback(integer  $position) : array

seekPlayback seeks to a given position

Parameters

integer $position

0

Returns

array —

status

getPlayedTracks()

getPlayedTracks() : array

getPlayedTracks will return the played tracks

Returns

array —

array of uuids

getCurrentTrack()

getCurrentTrack() : \SinusBot\File

getCurrentTrack returns the current track which will be played

Returns

\SinusBot\File

request()

request(string  $path, string  $method = "GET", string  $payload = null, boolean  $encoded = false) : array

request executes a request to the SinusBot API

Parameters

string $path

/api/v1/

string $method

http method

string $payload

http POST payload

boolean $encoded

when not encoded it will be JSON marshalled

Returns

array —

decoded JSON response

getError()

getError(integer  $code) : string

getError returns the string representive to the given http status code

Parameters

integer $code

http status code

Returns

string —

http status code string representive