public static void loadChannels(Arisu ar) throws Exception { File file = new File("channels.txt"); if (!file.exists()) { file.createNewFile(); } BufferedReader read = new BufferedReader(new FileReader(file)); String line; while ((line = read.readLine()) != null) { if (!ar.channels.contains(line)) { if (!line.startsWith("!") && !line.isEmpty()) { ar.channels.add(line); ar.joinChannel(line); Files.loadlog(ar, line); } } } System.out.println("loaded channels.txt"); System.out.println("channels: " + ar.channels.toString()); }
public static void loadlog(Arisu ar, String channel) throws Exception { File dir = new File("logs"); if (!dir.exists()) { dir.mkdir(); } File file = new File(dir + "/" + channel + ".log"); if (!file.exists()) { file.createNewFile(); } BufferedReader read = new BufferedReader(new FileReader(file)); String line; while ((line = read.readLine()) != null) { if (!ar.log.contains(line)) { if (!line.startsWith("!") && !line.isEmpty()) { ar.log.add(line); ar.joinChannel(line); } } } }