Manevolent / ts3j

An open-source Java Teamspeak 3 client library using the TS3 full client protocol
Apache License 2.0
107 stars 15 forks source link

Creating a new channel #20

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi. I wanna create a new channel using ts3j but I can't find any way to executeCommand and receive a channel id. Let me know a solution please :).

public int createChannel(Map<ChannelProperty, String> channelPropertyStringMap) {
    SingleCommand singleCommand = new SingleCommand("channelcreate", ProtocolRole.CLIENT);
    channelPropertyStringMap.forEach((channelProperty, value) -> singleCommand.add(new CommandSingleParameter(channelProperty.getName(), value)));
    return localTeamspeakClientSocket.executeCommand(?).get();
}
Manevolent commented 4 years ago

I believe singleCommand should be the parameter for executeCommand. If I'm wrong, I apologize, I haven't been in this codebase for a while.

Due to the fact that TS3 was reverse engineered to accomplish TS3j in the first place, there are gaps in the understanding that the community had (at the time TS3j was originally written, anyway) that led to gaps in TS3j's functionality that still exists today. This is somewhat evident from the other few feature requests that exist in the form of issues on this project, as you can see.

I'd suggest trying keywords such as channeladd, as there are a few other commands "out there" that also follow the same format (*add).

If a solution is reached on this issue, I can get an issue created to include it in TS3j as a base method in the API.

Flakebi commented 4 years ago

If it is about command arguments, I can help out, we have a list of them. Your channel property names might not match with the names that the server expects for channelcreate. In general, if you append return_code=<whatever> to a command, you get an answer that refers to that return_code (helpful to map answers to requests).