Remove auto create voice chanel

This commit is contained in:
Sebastien 2018-12-02 02:44:53 +02:00
parent 2d3535c8dc
commit 0eaefc8a6f
2 changed files with 5 additions and 4 deletions

View File

@ -193,7 +193,7 @@ public class MusicWebAPIController {
logger.trace("getPlaylist for " + guild.getName());
}
List<ChanelData> temp = new ArrayList<>();
for(VoiceChannel aChanel : FindGeneral.find(guild).getVoiceChannels()){
for(VoiceChannel aChanel : FindGeneral.find(guild)){
temp.add(new ChanelData(aChanel.getName(),aChanel.getId(),aChanel.getPosition()));
}
return new ResponseEntity<>(temp, HttpStatus.OK);

View File

@ -3,6 +3,7 @@ package net.Broken.audio;
import net.dv8tion.jda.core.entities.Category;
import net.dv8tion.jda.core.entities.Channel;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.VoiceChannel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -19,7 +20,7 @@ public class FindGeneral {
* @param guild Current guild
* @return General Category
*/
public static Category find(Guild guild){
public static List<VoiceChannel> find(Guild guild){
List<Category> categories = guild.getCategories();
Category finded = null;
for(Category cat : categories){
@ -29,9 +30,9 @@ public class FindGeneral {
}
}
if(finded == null)
finded = create(guild);
return guild.getVoiceChannels();
return finded;
return finded.getVoiceChannels();
}