TeamSpeak-3-Java-API icon indicating copy to clipboard operation
TeamSpeak-3-Java-API copied to clipboard

A "sendtextmessage" command returned with a server error.

Open NIFO43 opened this issue 5 years ago • 3 comments

Why I became this error?

[16:39:41 ERROR] [com.github.theholywaffle.teamspeak3.EventManager]: Event listener threw an exception com.github.theholywaffle.teamspeak3.api.exception.TS3CommandFailedException: A "sendtextmessage" command returned with a server error. at com.github.theholywaffle.teamspeak3.api.CommandFuture.checkForFailure(CommandFuture.java:416) ~[?:?] at com.github.theholywaffle.teamspeak3.api.CommandFuture.getUninterruptibly(CommandFuture.java:357) ~[?:?] at com.github.theholywaffle.teamspeak3.TS3Api.sendPrivateMessage(TS3Api.java:3996) ~[?:?] at de.nifo.teamspeaksystem.listener.ClientJoinListener.onClientJoin(ClientJoinListener.java:20) ~[?:?] at com.github.theholywaffle.teamspeak3.api.event.ClientJoinEvent.fire(ClientJoinEvent.java:176) ~[?:?] at com.github.theholywaffle.teamspeak3.EventManager$ListenerTask.run(EventManager.java:150) ~[?:?] at com.github.theholywaffle.teamspeak3.TS3Query.lambda$submitUserTask$0(TS3Query.java:282) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_231] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_231] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:1.8.0_231] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:1.8.0_231] at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]

`public class ClientJoinListener extends TS3EventAdapter {

private TS3Api api;

public ClientJoinListener(TS3Api api) {
    this.api = api;
}

@Override
public void onClientJoin(final ClientJoinEvent event) {
    System.out.println("Test");
    Client client = api.getClientInfo(event.getClientId());
    api.sendPrivateMessage(client.getId(), "Hello!");
}

}

NIFO43 avatar Feb 04 '20 15:02 NIFO43

just use public YourClass implements TS3Listener then go ahed with api.sendPrivateMessage(event.getClientId(), "Hello");

TheRealDomm avatar Feb 05 '20 18:02 TheRealDomm

Neat, the logger cuts off the second line of the error message :/ That line would usually contain the error name and ID, which would help us actually track down this issue. Without it, all I can do is guess:

  • Perhaps you're trying to send a message to a query client instead of a regular client. You should probably wrap that call to api.sendPrivateMessage in an if that checks for the client type, i.e.: if (client.isRegularClient()) { [...]
  • It could be that you're missing the required permissions to send private messages to clients, but that seems rather unlikely to me.

rogermb avatar May 04 '20 23:05 rogermb

It could be, that a client disconnects in the time the api needs to go trough the code; I got this often: A scanner client by ts-viewer/xyz connects and instantly disconnects again; I got a error because i cant send a message to someone who is offline.

Could this be the same Problem here? Check your Teamspeak Console for the whole server

Galileon-venta avatar May 14 '20 11:05 Galileon-venta