Ts3audiobot: WebAPI not working(?)

Created on 30 Mar 2018  路  4Comments  路  Source: Splamy/TS3AudioBot

Heya, I'm trying to make a simple script to manage the bot however I am stuck...

When executing:

<?php
$login = 'log';
$password = 'pass';
$url = 'http://localhost:8180/api/history/list';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
$result = curl_exec($ch);
curl_close($ch);  
echo($result);
?>

( Yes I stole it from https://github.com/Splamy/TS3AudioBot/issues/92 )

I'm getting
{"ErrorCode":17,"ErrorName":"MissingContext","ErrorMessage":"Command 'CommandHistoryLast' missing execution context 'HistoryManager'"}

same with the command 'song'
{"ErrorCode":17,"ErrorName":"MissingContext","ErrorMessage":"Command 'CommandSong' missing execution context 'PlayManager'"}

The console doesn't seem alarming..

23:13:17.1220| INFO 127.0.0.1 Requested: /api/song
23:13:28.4653| INFO 127.0.0.1 Requested: /api/song
23:15:57.8412| INFO 127.0.0.1 Requested: /api/song
23:16:00.9330| INFO 127.0.0.1 Requested: /api/song
23:16:01.6877| INFO 127.0.0.1 Requested: /api/song
23:16:42.1891| INFO 127.0.0.1 Requested: /api/history/list
23:16:43.9964| INFO 127.0.0.1 Requested: /api/history/list
23:23:40.5757| INFO 127.0.0.1 Requested: /api/history/list

Any tips or advice? Or am I an idiot?

question

Most helpful comment

No, it's optional :P

All 4 comments

Ah, yes, while it might be a little unintuitive, (and the error messages aren't helping a lot either currently), this is the correct behavior.

Since you can have many bots connected simultaneously, you have to select on which bot you want to execute these commands.

You can do this with the !bot use <id> (!your-subcommand)

In the api this would look something like that:

http://localhost:8180/api/bot/use/0/(/history/list

If this syntax looks a little strange to you, thake a look in our command system wiki how chaining works and how this translates in the api

Alright, it does work that way ;P
(btw u forgot to close the bracket in ur syntax)

No, it's optional :P

Nvm haha

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CookieCr2nk picture CookieCr2nk  路  4Comments

Adminio1 picture Adminio1  路  4Comments

Splamy picture Splamy  路  4Comments

officialtaxz picture officialtaxz  路  6Comments

Bluscream picture Bluscream  路  6Comments