-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBotchu.java
executable file
·82 lines (64 loc) · 2.5 KB
/
Botchu.java
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import org.jibble.pircbot.*;
public class Botchu extends PircBot {
public Botchu() {
this.setName("Paul_Bot");
}
// this is where we put in replies etc...
public void onMessage(String channel, String sender, String login, String hostname, String message) {
if (message.equalsIgnoreCase("@time")) {
String time = new java.util.Date().toString();
sendMessage(channel, sender + ": The time is now " + time);
}
if (message.equalsIgnoreCase("@go away")) {
sendMessage(channel, "Goodbye " + sender + ", it has been fun.");
disconnect();
}
if (message.equalsIgnoreCase("@test")) {
sendMessage(channel, sender + " your test worked. Good Jorb.");
}
if (message.equalsIgnoreCase("@help")) {
sendMessage(sender, "Commands: time, fight, test, go away");
}
if (message.equalsIgnoreCase("@fight")) {
sendMessage(channel, "/me establishes dominance over all other bots.");
}
if (message.equalsIgnoreCase("Ascend")) {
changeNick(String alpha_paul_bot);
}
if (recipientNick.equalsIgnoreCase(getNick())) {
joinChannel(channel);
}
/*
the above is my next trick which is practicing changing paulbots nickname.
Once I am able to get that figured out, I will have a command "Paulbot become "x" where x is what paulbot will change thier nickname too. They can then use a command to be implimented later, "wheres my bot at?".
There is a raw class below that will be used for a dice roll opperation. I am currently trying to make the program try and take input from irc and use it as variables / strings to be used later. Once I figure out how to do this, I will be able to start getting some serious work done on PaulBot.
/*
/* public void onMessage(String channel, String sender, String login, String hostname, String message) {
import java.util.Random;
public class RollDice {
public static int DiceRoll(int sides, int number) {
int num = 0;
int roll = 0;
Random r = new Random();
if (sides >= 3) {
long beg = System.nanoTime();
for (int i = 0; i < number ; i++) {
roll = r.nextInt(sides) + 1;
System.out.println(roll + "!");
num = num + roll;
}
long end = System.nanoTime();
}
else {
System.out.println("Something broke, tell Mechjesus about this!");
}
return num;
}
public static void main(String[] args)
{
System.out.println("For a total of "+DiceRoll(5, 6)+"!");
}
}
*/
}
}