Created
April 23, 2021 00:53
-
-
Save DanielHe4rt/4b72ff46633ed7606ca678d2204d3015 to your computer and use it in GitHub Desktop.
CleitinBot - Twitch Integrated Chat Bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CleitinBot - O bot mais arrombado da Twitch (dependendo de onde vc conectar ele) | |
* | |
* Para que você possa usar, gere um token de usuário no link abaixo e | |
* troque o token na parte de conexão. | |
* | |
* Link: https://twitchapps.com/tmi/ | |
* | |
* Ao trocar, use a função JOIN para conectar no canal predefinido e fique brincando | |
* com o código | |
* | |
* Esse código foi feito em condições precárias por alguém que programa em Java | |
* no máximo 1x por ano então peço perdão pelo crime cometido abaixo. | |
* | |
* Deus tenha pena de você executando essse código. | |
* | |
*/ | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.InputStreamReader; | |
import java.io.OutputStreamWriter; | |
import java.net.Socket; | |
import java.util.ArrayList; | |
import java.util.Random; | |
import java.util.Scanner; | |
class Bot { | |
public String[] messages; | |
public static void main(String args[]) { | |
System.out.println("Fodase"); | |
System.out.println("Super CleitinBot motherfucker AI da twitch em java"); | |
while (true) { | |
output("danielhe4rt", ""); | |
Scanner reader = new Scanner(System.in); | |
String command = reader.nextLine(); | |
switch (command) { | |
case "oi": | |
outputln("CleitinBot", "eae mano td tranquilo?"); | |
break; | |
case "hackeia um face pra mim": | |
hackearFacebook(); | |
break; | |
case "quanto tempo para virar um junior?": | |
outputln("CleitinBot", "mano para de fazer pergunta besta e vai estudar pra virar junior"); | |
break; | |
case "conecta ai": | |
twitchConnect("danielhe4rt"); | |
break; | |
default: | |
outputln("CleitinBot", "vai se fude"); | |
} | |
} | |
} | |
static void send(BufferedWriter bw, String command, String payload) { | |
try { | |
bw.write(command + " " + payload + "\r\n"); | |
bw.flush(); | |
} catch (Exception e) { | |
System.out.println("Exception: " + e); | |
} | |
} | |
private static void twitchConnect(String channel) { | |
// INSERIR TOKEN AQUI | |
String oauth = "oauth:seutokenaqui"; | |
try { | |
Socket server = new Socket("irc.chat.twitch.tv", 6667); | |
outputln("CleitinBot", "Conectando no rolê."); | |
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(server.getOutputStream()); | |
BufferedWriter bwriter = new BufferedWriter(outputStreamWriter); | |
send(bwriter, "PASS", oauth); | |
send(bwriter, "NICK", "CleitinBot"); | |
// Canais para dar join | |
send(bwriter, "JOIN", "#gaules"); | |
send(bwriter, "JOIN", "#danielhe4rt"); | |
InputStreamReader inputStreamReader = new InputStreamReader(server.getInputStream()); | |
BufferedReader breader = new BufferedReader(inputStreamReader); | |
String line = null; | |
ArrayList<String> cleitinRespondeAtualizado = new ArrayList<String>(); | |
while (true) { | |
line = breader.readLine(); | |
// outputln("debug", line); | |
if(!line.contains("tmi.twitch.tv PRIVMSG #")) { | |
continue; | |
} | |
String nickname = retrieveNickname(line); | |
String message = retrieveMessage(line); | |
String channelzada = retrieveChannel(line); | |
System.out.println(channelzada + " -> " +nickname + ": " + message); | |
if(!cleitinRespondeAtualizado.contains(message)) { | |
cleitinRespondeAtualizado.add(message); | |
} | |
if(message.contains("cleitin")) { | |
Random randomGenerator = new Random(); | |
int index = randomGenerator.nextInt(cleitinRespondeAtualizado.size()); | |
send(bwriter, "PRIVMSG", "#danielhe4rt : @"+ nickname + ", " + cleitinRespondeAtualizado.get(index)); | |
} | |
if(line.equals("")){ | |
continue; | |
} | |
} | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} | |
} | |
private static void hackearFacebook() { | |
try { | |
outputln("CleitinBot", "demoro irmão, perai q é nois"); | |
Thread.sleep(1000); | |
outputln("CleitinBot", "tá quase perai"); | |
Thread.sleep(1000); | |
outputln("CleitinBot", "blz agora foi se liga"); | |
Thread.sleep(1000); | |
for (int i = 0; i < 100000; i++) { | |
String hackinagem = Integer.toBinaryString(i); | |
System.out.print(hackinagem); | |
} | |
outputln("CleitinBot", "Invasão finalizada! Recuperando dados..."); | |
Thread.sleep(1000); | |
outputln("CleitinBot", "Usuário: paunoseucu@gmail.com | Senha: comi o cu de quem talendo"); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} | |
} | |
public static void output(String nickname, String message) { | |
System.out.print(nickname + ": " + message); | |
} | |
public static void outputln(String nickname, String message) { | |
System.out.println(nickname + ": " + message); | |
} | |
private static String retrieveNickname(String raw) { | |
String rawCommand[] = raw.split(":"); | |
return rawCommand[1].split("!")[0]; | |
} | |
// #danielhe4rt : tralala | |
private static String retrieveMessage(String raw) { | |
String channel = retrieveChannel(raw); | |
String rawCommand[] = raw.split("#"+ channel + " :"); | |
rawCommand[0] = ""; | |
return String.join("",rawCommand); | |
} | |
private static String retrieveChannel(String raw) { | |
String rawCommand[] = raw.split("tmi.twitch.tv PRIVMSG #"); | |
return rawCommand[1].split(" :")[0]; | |
} | |
} |
Melhor bot que eu já vi
bot corno
q isso
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bot corno