Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TPPDekuBot;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.net.URLConnection;
- import java.util.List;
- import java.util.concurrent.LinkedBlockingQueue;
- import org.apache.http.HttpResponse;
- import org.apache.http.NameValuePair;
- import org.apache.http.client.HttpClient;
- import org.apache.http.client.entity.UrlEncodedFormEntity;
- import org.apache.http.client.methods.HttpPost;
- import org.apache.http.impl.client.HttpClients;
- public class DekuBotMain {
- public static LinkedBlockingQueue<String> messages = new LinkedBlockingQueue<>();
- public static LinkedBlockingQueue<String> whispers = new LinkedBlockingQueue<>();
- public static void main(String[] args) {
- DekuBot b = new DekuBot();
- DekuBot c = new DekuBot();
- try {
- c.setVerbose(true);
- b.setVerbose(true);
- b.connect("199.9.253.120", 6667, "oauth:OneHand");
- c.connect("irc.twitch.tv", 6667, "oauth:OneHand");
- b.sendRawLine("CAP REQ :twitch.tv/commands");
- b.sendRawLine("CAP REQ :twitch.tv/membership");
- c.sendRawLine("CAP REQ :twitch.tv/commands");
- c.sendRawLine("CAP REQ :twitch.tv/membership");
- b.joinChannel("#_killermapper_1417986539782");
- b.joinChannel("#_killermapper_1434489343452");
- b.joinChannel("#_mehcheniti_1420060673372");
- b.joinChannel("#_wow_deku_onehand_1425759882381");
- c.joinChannel("#the_chef1337");
- c.joinChannel("#twitchtriestoplay");
- c.joinChannel("#assassinskye");
- //c.joinChannel("#twitch_plays_3ds");
- b.startBanLog();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- /**
- * Returns a page's Source code as a string
- *
- * @param url Page to look up
- * @return Page Source as a String
- * @throws IOException
- */
- public static String getUrlSource(String url) throws IOException {
- URL u = new URL(url);
- URLConnection uc = u.openConnection();
- uc.setReadTimeout(20000);
- StringBuilder a;
- try (BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream(), "UTF-8"))) {
- String inputLine;
- a = new StringBuilder();
- while ((inputLine = in.readLine()) != null) {
- a.append(inputLine + "\n");
- }
- }
- return a.toString();
- }
- public static String sendPost(String url, List<NameValuePair> params, List<NameValuePair> header) throws IOException {
- HttpClient httpclient = HttpClients.createDefault();
- HttpPost httppost = new HttpPost(url);
- httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
- if (header != null && !header.isEmpty()) {
- for (NameValuePair el : header) {
- httppost.addHeader(el.getName(), el.getValue());
- }
- }
- HttpResponse response = httpclient.execute(httppost);
- return response.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement