blob: a872432a294e980c90785d8a43f2a9a0fee7e965 (
plain)
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
|
package com.encrox.twitchbot.client;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import com.encrox.twitchbot.client.Plugin;
import com.encrox.twitchbot.client.messages.Login;
public class Core {
public static String username, password;
private static BufferedReader br;
public static Client client;
public static void main(String[] args) {
br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Twitchbot-client build 201510042114");
System.out.println("Setting up...");
setup();
System.out.println("Connecting to the server...");
client = new Client();
if(client.connect() != MessageTypes.OK) {
System.out.println("Failed to connect to the server!");
return;
}
Login login = new Login();
do {
System.out.println("Encrox username: ");
try {
login.setUsername(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Encrox password: ");
try {
login.setPassword(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
} while(client.send(login) != MessageTypes.OK);
client.login();
new PluginHandler(client);
}
public static void setup() {
File plugindir = new File("plugins/");
if(!plugindir.exists()) {
plugindir.mkdir();
}
}
}
|