summaryrefslogtreecommitdiff
path: root/src/com/encrox/twitchbot/client/Core.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/encrox/twitchbot/client/Core.java')
-rwxr-xr-xsrc/com/encrox/twitchbot/client/Core.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/com/encrox/twitchbot/client/Core.java b/src/com/encrox/twitchbot/client/Core.java
new file mode 100755
index 0000000..a872432
--- /dev/null
+++ b/src/com/encrox/twitchbot/client/Core.java
@@ -0,0 +1,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();
+ }
+ }
+
+}