-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bot.pde
executable file
·46 lines (33 loc) · 1.07 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
public class Bot extends PircBot {
//change these strings
String channel = "#yourchannel";
String name = "botname";
//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 = "oauth:requestyourtoken";
public Bot() {
this.setName(name);
// Enable debugging output.
setVerbose(true);
try {
// Connect to the IRC server.
connect("irc.twitch.tv", 6667, twitchOauth);
}
catch (Exception e) {
println(e.getMessage());
}
// Join the #pircbot channel.
joinChannel(channel);
// Not sure if 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");
}
}