Browse Source

Keine Ahnung was ich genau geändert habe

greetings_byebyes
yl60lepu 4 years ago
parent
commit
220e67f06c
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/SayCommand.java

+ 8
- 4
app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/SayCommand.java View File

@ -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;
}


Loading…
Cancel
Save