-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyBotMain.java
More file actions
59 lines (44 loc) · 1.45 KB
/
Copy pathMyBotMain.java
File metadata and controls
59 lines (44 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import org.jibble.pircbot.*;
import java.util.Timer;
import java.util.Random;
import java.util.List;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
public class MyBotMain {
public static void main(String[] args) throws Exception {
// Now start our bot up.
MyBot bot = new MyBot();
// Enable debugging output.
bot.setVerbose(true);
// Connect to the IRC server.
bot.connect("irc.twitch.tv",6667,dbids.twitchLogin);
ArrayList<String> channels = readFile("channels.txt");
// Join the #pircbot channel.
for (int i=0; i < channels.size(); i++) {
bot.joinChannel(channels.get(i));
}
}
public static ArrayList<String> readFile(String fileName) {
ArrayList<String> newString = new ArrayList<String>();
int counter = 0;
try (BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Kevin\\Desktop\\bot\\sneetoswoman\\" + fileName)))
{
String sCurrentLine;
while ((sCurrentLine = br.readLine()) != null) {
//System.out.println(sCurrentLine);
newString.add(counter, sCurrentLine);
counter++;
}
} catch (IOException e) {
e.printStackTrace();
}
return newString;
} // end of read file
}