|
|
@ -16,6 +16,9 @@ import java.util.UUID; |
|
|
|
|
|
|
|
public class SayCommand extends YoshiCommand { |
|
|
|
|
|
|
|
public static String resourceToDelete = null; |
|
|
|
|
|
|
|
|
|
|
|
protected final String[] requiredArguments = {"text", "channel"}; |
|
|
|
|
|
|
|
|
|
|
@ -27,7 +30,7 @@ public class SayCommand extends YoshiCommand { |
|
|
|
public boolean execute() { |
|
|
|
if(!super.execute()) return false; |
|
|
|
|
|
|
|
String path = Resources.buildTempAudioFilePath("tts"); |
|
|
|
String path = Resources.buildTempAudioFilePath(UUID.randomUUID().toString()); |
|
|
|
|
|
|
|
try { |
|
|
|
ProcessBuilder pb = new ProcessBuilder( |
|
|
@ -43,6 +46,10 @@ public class SayCommand extends YoshiCommand { |
|
|
|
|
|
|
|
Process p = pb.start(); |
|
|
|
int exitCode = p.waitFor(); |
|
|
|
if(resourceToDelete != null) |
|
|
|
synchronized (resourceToDelete){ |
|
|
|
resourceToDelete = path; |
|
|
|
} |
|
|
|
} catch (IOException | InterruptedException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return false; |
|
|
@ -59,9 +66,6 @@ public class SayCommand extends YoshiCommand { |
|
|
|
YoshiBot.getInstance().audioPlayerManager.loadItem(path, new AudioLoadResultHandlerImpl(ac)); |
|
|
|
vc.getGuild().getAudioManager().openAudioConnection(vc); |
|
|
|
|
|
|
|
File deleteFile = new File(path); |
|
|
|
deleteFile.delete(); //FIXME Funktioniert noch nicht |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|