Merge remote-tracking branch 'origin/master'

This commit is contained in:
Manevolent
2019-05-29 11:50:47 -04:00
3 changed files with 42 additions and 0 deletions
+4
View File
@@ -4,6 +4,8 @@ Discord: https://discord.gg/4q9jpCa
TS3J is an open-source implementation of the reverse-engineered Teamspeak3 full server/client protocol, as an adaptation of Splamy's C# TS3Client source code. You can find that here: https://github.com/Splamy/TS3AudioBot/. TS3J is an open-source implementation of the reverse-engineered Teamspeak3 full server/client protocol, as an adaptation of Splamy's C# TS3Client source code. You can find that here: https://github.com/Splamy/TS3AudioBot/.
This project is the network-level API library for the reference implementation of Teamspeak3 for **Manebot**, my multiplatform chatbot that you can extend with your own plugins. GitHub: https://github.com/Manevolent/manebot-ts3
A standalone proof-of-concept was created to wrap ts3j: https://github.com/Manevolent/ts3j-musicbot A standalone proof-of-concept was created to wrap ts3j: https://github.com/Manevolent/ts3j-musicbot
(Shameless plug) If you want to deliver a great music bot, check out ffmpeg4j, a wrapper around the native C library FFmpeg, to get insanely low CPU usage on your YouTube video downloads (or streams if you don't want to hit disk), and audio playback: (Shameless plug) If you want to deliver a great music bot, check out ffmpeg4j, a wrapper around the native C library FFmpeg, to get insanely low CPU usage on your YouTube video downloads (or streams if you don't want to hit disk), and audio playback:
@@ -119,3 +121,5 @@ public byte[] provide() {
Refer to the `setVoiceHandler` and `setWhisperHandler` methods to supply a Consumer object to receive Voice and Whisper packets. You will need to decode the packets yourself, and insert packet-loss-correction as needed. Refer to the `setVoiceHandler` and `setWhisperHandler` methods to supply a Consumer object to receive Voice and Whisper packets. You will need to decode the packets yourself, and insert packet-loss-correction as needed.
Note that the first 5 packets starting a voice session are marked with the COMPRESSED flag. The final voice packet, intended to singal to close your decoder and flush samples, is always empty (0-length byte array). Note that the first 5 packets starting a voice session are marked with the COMPRESSED flag. The final voice packet, intended to singal to close your decoder and flush samples, is always empty (0-length byte array).
Manebot can do this in its TS3 plugin, which uses TS3j: https://github.com/Manevolent/manebot-ts3/tree/master/src/main/java/io/manebot/plugin/ts3/platform/audio/voice
@@ -839,6 +839,42 @@ public class LocalTeamspeakClientSocket
return executeCommand(banCommand, command -> new Ban(command.toMap())).get(); return executeCommand(banCommand, command -> new Ban(command.toMap())).get();
} }
public void setDescription(String description)
throws InterruptedException, ExecutionException, TimeoutException, CommandException, IOException {
setClientDescription(getClientId(), description);
}
public void setClientDescription(Client client, String description)
throws InterruptedException, ExecutionException, TimeoutException, CommandException, IOException {
setClientDescription(client.getId(), description);
}
public void setClientDescription(int clid, String description)
throws InterruptedException, ExecutionException, TimeoutException, CommandException, IOException {
editClient(clid, Collections.singletonMap("client_description", description));
}
public void editClient(Client client, Map<String, String> properties)
throws InterruptedException, ExecutionException, TimeoutException, CommandException, IOException {
editClient(client.getId(), properties);
}
public void editClient(int clid, Map<String, String> properties)
throws InterruptedException, ExecutionException, TimeoutException, CommandException, IOException {
MultiCommand command = new MultiCommand(
"clientedit",
ProtocolRole.CLIENT,
properties.entrySet().stream().map(x ->
new SingleCommand("clientedit", ProtocolRole.CLIENT, // name is redundant here
new CommandSingleParameter(x.getKey(), x.getValue())
)).collect(Collectors.toList()
));
command.add(new CommandSingleParameter("clid", Integer.toString(clid)));
executeCommand(command).complete();
}
public Iterable<Ban> banClient(Client client, Integer timeInSeconds, String reason) public Iterable<Ban> banClient(Client client, Integer timeInSeconds, String reason)
throws InterruptedException, ExecutionException, TimeoutException, CommandException, IOException { throws InterruptedException, ExecutionException, TimeoutException, CommandException, IOException {
return banClient(client.getId(), timeInSeconds, reason); return banClient(client.getId(), timeInSeconds, reason);
@@ -29,6 +29,8 @@ public class ServerConnectionTest {
assertEquals(client.getState(), ClientConnectionState.CONNECTED); assertEquals(client.getState(), ClientConnectionState.CONNECTED);
client.setDescription("Heyo");
client.subscribeAll(); client.subscribeAll();
Thread.sleep(100000); Thread.sleep(100000);