/
Bot.pde
48 lines (34 loc) · 1.14 KB
/
Bot.pde
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
public class Bot extends PircBot {
//change these strings
String channel = "#yourChannel"; //must match your channel name
//an oauth token looks like oauth:1l33afoi4tvlulkky1eile0ki59d52
//This is NOT the streaming code
//if you trust this 3rd party site you can get it here:
//https://twitchapps.com/tmi/
String twitchOauth = "your auth";
String name = "botname";
public Bot() {
this.setName(name);
// Enable debugging output.
setVerbose(true);
try {
// Connect to the IRC server.
//connect("irc.foonetic.net");
connect("irc.twitch.tv", 6667, twitchOauth);
}
catch (Exception e) {
println(e.getMessage());
}
// Join the #pircbot channel.
joinChannel(channel);
//not sure it's necessary
this.sendRawLine("CAP REQ :twitch.tv/membership");
}
public void onMessage(String channel, String sender, String login, String hostname, String message) {
parseCommand(message);
//send message to the whole channel
//sendMessage(channel,"Welcome "+login+"!");
//send PM
//sendRawLineViaQueue("PRIVMSG #jtv :/w "+sender+" psst, secret");
}
}