-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.pl
executable file
·153 lines (128 loc) · 3.76 KB
/
events.pl
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/perl
use IO::Socket;
#events function, this is called every time the main loop loops.
sub events {
#change the bot controller nick to suit your case
if($nick =~ 'bstrds') {
#reply to 'hi' from his admin
if($text =~ 'hi st0n3r') {
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :hi Master!\r\n";
} else {
print $con "PRIVMSG $channel :hi Master!\r\n";
}
}
#shuts down
if($text =~ "\!fuckoff") {
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :yes MASTER..\r\n";
} else {
print $con "PRIVMSG $channel :okay..\r\n";
}
&quitt;
}
#prints a dictionary definition of the argument
if ($text =~ "\!dict") {
$dix = &dquer($nick, $channel, $text);
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :$dix\r\n";
} else {
print $con "PRIVMSG $channel :$dix\r\n";
}
}
#joins specified channel
if ($text =~ "\!join") {
($order, $chann) = split(/ /, $text);
print $con "JOIN $chann \r\n";
print $con "PRIVMSG $nick :joining channel $chann, master $nick!\r\n";
}
#parts specified channel
if ($text =~ "\!part") {
($order, $chann) = split(/ /, $text);
print $con "PART $chann :aw noooo!\r\n";
print $con "PRIVMSG $nick :parting channel $chann, master $nick!\r\n";
}
#performs a seen operation on specified nick
if ($text =~ "\!seen") {
&doseen;
}
#returns a random fortune
if ($text =~ "\!fortune") {
my $lol = `/usr/games/fortune`;
$lol =~ s/\s*\n\s*/ /g;
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :$lol\r\n";
} else {
print $con "PRIVMSG $channel :$lol\r\n";
}
}
} else {
#public 'hi' operation
if($text =~ 'hi st0n3r') {
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :hi $nick!\r\n";
} else {
print $con "PRIVMSG $channel :hi $nick\r\n";
}
}
#returns a random fortune
if ($text =~ "\!fortune") {
my $lol = `/usr/games/fortune`;
$lol =~ s/\s*\n\s*/ /g;
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :$lol\r\n";
} else {
print $con "PRIVMSG $channel :$lol\r\n";
}
}
#performs a seen operation on specified nick
if ($text =~ "\!seen") {
&doseen;
}
#prints a dictionary definition of the argument
if ($text =~ "\!dict") {
$dix = &dquer($nick, $channel, $text);
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :$dix\r\n";
} else {
print $con "PRIVMSG $channel :$dix\r\n";
}
}
#check if someone is trying to execute an admin command :P
@wordlist2 = qw(!fortune !seen !join !part !dict !fuckoff);
foreach (@texts) {
if($_ ~~ @wordlist2) {
print "\n*\n*\n* sumeone's tryin to execute commands on my ass boss\n*\n*\n*";
}
}
}
#command list to ignore(if the message doesnt have any of these words, the trytoanswer sub is called)
my @commandlist = qw(!part !random !join !seen !dict !fuckoff hi !help st0n3r !fortune nigger bastard chicken sissy fag);
if ($answer =~ 'PRIVMSG') {
if($texts[0] ~~ @commandlist) {
print "a command is being executed\r\n";
} else {
&trytoanswer;
}
}
#prints help text
if ($text =~ "\!help") {
$helpzor = "commands \n
\!fortune (prints a random fortune-cookie like piece of advice)
\!seen (prints the channel the specified nick was last seen in, plus his last quote)
\!join (st0n3r joins the specified channel)
\!part (st0n3r leaves the specified channel)
\!dict (prints the dictionary definition of the specified word, if there is one)
\!fuckoff (st0n3r disconnects from the server)
\!help (displays this text)";
$helpzor =~ s/\s*\n\s*/-->/g;
if ( $channel =~ 'st0n3r') {
print $con "PRIVMSG $nick :$helpzor\r\n";
} else {
print $con "PRIVMSG $channel :$helpzor\r\n";
}
}
return;
#more cool stuff to come here..
}
1;