Properties

$uuid

$uuid : string

UUID stores the SinusBot Bot 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

Methods

__construct()

__construct(string  $url = 'http://127.0.0.1:8087', string  $timeout = 8000) : void

__construct

Parameters

string $url

SinusBot Bot URL

string $timeout

HTTP Timeout which is used to perform HTTP API requests

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

login()

login(string  $username, string  $password, string  $uuid = null) : boolean

login logs on to the SinusBot and retrieves the token

Parameters

string $username

SinusBot username

string $password

SinusBot password

string $uuid

SinusBot Bot UUID

Returns

boolean —

success

getFiles()

getFiles() : array

getFiles returns the files for the user account

Returns

array —

files

getRadioStations()

getRadioStations(string  $search = "") : array

getRadioStations returns the imported radio stations

Parameters

string $search

optional name of the search query

Returns

array —

radio stations

getInfo()

getInfo() : array

getInfo returns the bot infos

Returns

array —

bot infos

getPlaylists()

getPlaylists() : array

getPlaylists returns the playlists

Returns

array —

playlists

createPlaylist()

createPlaylist(string  $playlistName) : array

createPlaylist creates a new playlist

Parameters

string $playlistName

name of the playlist

Returns

array —

status

importPlaylist()

importPlaylist(string  $url) : array

importPlaylist imports a new playlist from youtube-dl

Parameters

string $url

youtube-dl URL

Returns

array —

status

addURL()

addURL(string  $url, string  $title, string  $parent = "") : array

addURL

Parameters

string $url

stream URL

string $title

track title

string $parent

subfolder UUID, empty value means root folder

Returns

array —

status

addFolder()

addFolder(string  $folderName = "Folder", string  $parent = "") : array

addFolder

Parameters

string $folderName

folder name

string $parent

subfolder UUID, empty value means root folder

Returns

array —

status

moveFolder()

moveFolder(string  $folderUUID, string  $parent = "") : array

moveFolder

Parameters

string $folderUUID

folder uuid

string $parent

subfolder UUID, empty value means root folder

Returns

array —

status

renameFolder()

renameFolder(string  $folderName, string  $folderUUID) : array

renameFolder

Parameters

string $folderName

Folder name

string $folderUUID

uuid of the folder

Returns

array —

status

getJobs()

getJobs() : array

getJobs

Returns

array

addJob()

addJob(string  $URL) : array

addJob

Parameters

string $URL

{YouTube-URL, SoundCloud-URL, Directfile}

Returns

array —

status

deleteJob()

deleteJob(string  $jobUUID) : array

deleteJob

Parameters

string $jobUUID

job uuid

Returns

array —

status

deleteFinishedJobs()

deleteFinishedJobs() : array

deleteFinishedJobs

Returns

array —

status

uploadTrack()

uploadTrack(string  $path) : array

uploadTrack

Parameters

string $path

/var/www/song.mp3

Returns

array —

status

getUsers()

getUsers() : array<mixed,\SinusBot\User>

getUsers

Returns

array<mixed,\SinusBot\User> —

users

addUser()

addUser(string  $username, string  $password, integer  $privileges) : \SinusBot\User

addUser

Parameters

string $username

Username

string $password

Password

integer $privileges

Bitmask-Value

Returns

\SinusBot\User

user object

getUserByUUID()

getUserByUUID(string  $uuid) : \SinusBot\User

getUserByUUID

Parameters

string $uuid

User ID

Returns

\SinusBot\User

user object

getUserByName()

getUserByName(string  $username) : \SinusBot\User

getUserByName

Parameters

string $username

Username

Returns

\SinusBot\User

user object

getInstances()

getInstances() : \SinusBot\[]Instance

getInstances

Returns

\SinusBot\[]Instance

createInstance()

createInstance(string  $nickname = "SinusBot MusicBot", string  $backend = "ts3") : array

createInstance

Parameters

string $nickname

Name of the Bot

string $backend

SinusBot backend (Discord or TS³)

Returns

array —

status

getDefaultBot()

getDefaultBot() : string

getDefaultBot

Returns

string

getBotLog()

getBotLog() : array

getBotLog

Returns

array —

log

getInstanceByUUID()

getInstanceByUUID(string  $uuid) : \SinusBot\Instance

getInstanceByUUID

Parameters

string $uuid

SinusBot instance UUID

Returns

\SinusBot\Instance

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