From 319e82391bfb8822fd75684f17ae28b26c1e3b0c Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Mon, 25 Apr 2022 18:49:40 +0200 Subject: Initial commit --- src/com/encrox/twitchbot/client/Core.java | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 src/com/encrox/twitchbot/client/Core.java (limited to 'src/com/encrox/twitchbot/client/Core.java') 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(); + } + } + +} -- cgit v1.2.1