Permalink
Browse files

Updates are updated.

  • Loading branch information...
1 parent 021a737 commit de6ef9acda80e3e5ae82329cbfa436c1d0f1b004 @grickit committed Oct 14, 2012
@@ -62,8 +62,8 @@ our($sender,$account,$hostname,$command,$target,$message,$event,$receiver) = par
our $sl = $botName.'[;,]';
our $cm = '!';
-our $version = 'Gambot Core MK III | Plugin Parser 6 ';
-our $about = 'I am a basic Gambot. http://grickit.github.com/ irc://chat.freenode.net/%23%23Gambot';
+our $version = 'Gambot Core MK III | Plugin Parser 6 | <http://grickit.github.com/>';
+our $about = 'I am a basic Gambot. <http://grickit.github.com/> <irc://chat.freenode.net/%23%23Gambot>';
our %permissions;
View
@@ -34,26 +34,40 @@
$IRCParser::permissions{'wesnoth/developer/shadowmaster*'} = '*';
$IRCParser::sl = '';
-$IRCParser::cm = '.';
+$IRCParser::cm = '(?:&|(?:'.$IRCParser::botName.'[:,] ))';
# Autojoin list
if($IRCParser::pipeID eq 'fork10') {
actOut('JOIN','##Gambot',undef);
}
sub on_server_ping {}
-sub on_private_message {}
+sub on_private_message {
+ runPlugin("$FindBin::Bin/plugins/basic/ctcp.pm");
+ on_public_message();
+}
sub on_public_message {
-
+ runPlugin("$FindBin::Bin/plugins/basic/about.pm");
runPlugin("$FindBin::Bin/plugins/hug.pm");
+ runPlugin("$FindBin::Bin/plugins/actions.pm");
+ runPlugin("$FindBin::Bin/plugins/temperature.pm");
+ runPlugin("$FindBin::Bin/plugins/time.pm");
+ runPlugin("$FindBin::Bin/plugins/staff/joinpart.pm");
+ runPlugin("$FindBin::Bin/plugins/staff/speak.pm");
+ runPlugin("$FindBin::Bin/plugins/staff/op.pm");
+ runPlugin("$FindBin::Bin/plugins/staff/voice.pm");
+ runPlugin("$FindBin::Bin/plugins/staff/quiet.pm");
+ runPlugin("$FindBin::Bin/plugins/staff/kick.pm");
}
sub on_private_notice {}
sub on_public_notice {}
sub on_join {}
sub on_part {}
sub on_quit {}
-sub on_mode {}
+sub on_mode {
+ runPlugin("$FindBin::Bin/plugins/staff/mode.pm");
+}
sub on_nick {}
sub on_kick {}
sub on_server_message {
@@ -0,0 +1,21 @@
+if ($message =~ /^ACTION ([a-zA-Z]+) $botName$/) {
+ if ($1 =~ /^kicks$/i) {
+ actOut('ACTION',$target,"kicks $sender");
+ }
+ elsif ($1 =~ /^hugs$/) {
+ actOut('ACTION',$target,"");
+ }
+ elsif ($1 =~ /^kisses$/) {
+ actOut('ACTION',$target,'calls the police');
+ }
+ elsif ($1 =~ /^slaps$/) {
+ actOut('MESSAGE',$target,'I may have deserved that.');
+ }
+ elsif ($1 =~ /^murders$/) {
+ ACT('ACTION',$target,'dies... I guess?');
+ }
+}
+
+if ($message =~ /^ACTION slaps $botName around a bit with a large trout$/) {
+ actOut('MESSAGE',$target,"$receiver: The 90's called. They want their IRC client back.");
+}
@@ -0,0 +1,7 @@
+if ($message =~ /^${sl}${cm}about$/) {
+ actOut('MESSAGE',$target,"$receiver: $about");
+}
+
+if ($message =~ /^${sl}${cm}version$/) {
+ actOut('MESSAGE',$target,"$receiver: $version");
+}
@@ -0,0 +1,16 @@
+if ($message =~ /^(VERSION|CLIENTINFO).*$/) {
+ actOut('NOTICE',$sender,"$1 $version");
+}
+
+if ($message =~ /^TIME.*$/) {
+ require POSIX;
+ actOut('NOTICE',$sender,'TIME '.POSIX::strftime('%Y-%m-%d %H:%M:%S',localtime).'');
+}
+
+if ($message =~ /^PING.*$/) {
+ actOut('NOTICE',$sender,'PING '.time.'');
+}
+
+if ($message =~ /^FINGER.*$/) {
+ actOut('NOTICE',$sender,"FINGER Take your fingers off me!");
+}
@@ -0,0 +1,14 @@
+if ($message =~ /^${sl}${cm}join $validChannel$/) {
+ authCheck($1,$hostname) ? actOut('JOIN',$1) : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}part $validChannel ?(.+)?$/) {
+ my $partmessage = "[requested by $sender]";
+ $partmessage .= ": $2" if $2;
+ authCheck($1,$hostname) ? actOut('PART',$1,$partmessage) : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}part$/) {
+ my $partmessage = "[requested by $sender]";
+ authCheck($target,$hostname) ? actOut('PART',$target,$partmessage) : authError($sender,$target,$target);
+}
@@ -0,0 +1,10 @@
+if ($message =~ /^${sl}${cm}kick $validNick ?(.+)?$/) {
+ my $kickmessage = "[requested by $sender]";
+ $kickmessage .= ": $2" if $2;
+ if(authCheck($1,$hostname)) {
+ actOut('MESSAGE','chanserv',"op $target $botName");
+ actOut('LITERAL',undef,"event_schedule>op$target>send_server_message>KICK $target $1 :$kickmessage");
+ actOut('LITERAL',undef,"event_schedule>op$target>send_server_message>PRIVMSG chanserv :deop $target $botName");
+ }
+ else { authError($sender,$target,$1); }
+}
@@ -0,0 +1,3 @@
+if($message =~ /^\+o $botName/) {
+ actOut('LITERAL',undef,"event_fire>op$target");
+}
@@ -0,0 +1,23 @@
+if ($message =~ /^${sl}${cm}op $validChannel $validNick$/) {
+ authCheck($1,$hostname) ? actOut('MESSAGE','chanserv',"op $1 $2") : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}op(?:me)?$/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"op $target $sender") : authError($sender,$target,$target);
+}
+
+if ($message =~ /^${sl}${cm}op $validNick$/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"op $target $1") : authError($sender,$target,$target);
+}
+
+if ($message =~ /^${sl}${cm}deop $validChannel $validNick$/) {
+ authCheck($1,$hostname) ? actOut('MESSAGE','chanserv',"deop $1 $2") : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}deop(?:me)?$/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"deop $target $sender") : authError($sender,$target,$target);
+}
+
+if ($message =~ /^${sl}${cm}deop $validNick$/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"deop $target $1") : authError($sender,$target,$target);
+}
@@ -0,0 +1,15 @@
+if ($message =~ /^${sl}${cm}quiet $validChannel $validNick/) {
+ authCheck($1,$hostname) ? actOut('MESSAGE','chanserv',"quiet $1 $2") : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}quiet $validNick/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"quiet $target $1") : authError($sender,$target,$target);
+}
+
+if ($message =~ /^${sl}${cm}unquiet $validChannel $validNick$/) {
+ authCheck($1,$hostname) ? actOut('MESSAGE','chanserv',"unquiet $1 $2") : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}unquiet $validNick/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"unquiet $target $1") : authError($sender,$target,$target);
+}
@@ -0,0 +1,11 @@
+if ($message =~ /^${sl}${cm}tell $validChannel (.+)$/) {
+ authCheck($1,$hostname) ? actOut('MESSAGE',$1,$2) : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}do $validChannel (.+)$/) {
+ authCheck($1,$hostname) ? actOut('ACTION',$1,$2) : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}notify $validChannel (.+)$/) {
+ authCheck($1,$hostname) ? actOut('NOTICE',$1,$2) : authError($sender,$target,$1);
+}
@@ -0,0 +1,16 @@
+if ($message =~ /^${sl}${cm}voice $validChannel $validNick$/) {
+ authCheck($1,$hostname) ? actOut('MESSAGE','chanserv',"voice $1 $2") : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}voice(?:me)?$/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"voice $target $sender") : authError($sender,$target,$target);
+}
+
+if ($message =~ /^${sl}${cm}devoice $validChannel $validNick$/) {
+ authCheck($1,$hostname) ? actOut('MESSAGE','chanserv',"devoice $1 $2") : authError($sender,$target,$1);
+}
+
+if ($message =~ /^${sl}${cm}devoice(?:me)?$/) {
+ authCheck($target,$hostname) ? actOut('MESSAGE','chanserv',"devoice $target $sender") : authError($sender,$target,$target);
+}
+
@@ -0,0 +1,9 @@
+if ($message =~ /^${sl}${cm}ftc (-?[0-9]*.*[0-9]*)$/) {
+ my $answer = (5/9) * ($1 - 32);
+ actOut('MESSAGE',$target,"$receiver: $answer°C");
+}
+
+if ($message =~ /^${sl}${cm}ctf (-?[0-9]*.*[0-9]*)$/) {
+ my $answer = (9/5) * $1 + 32;
+ actOut('MESSAGE',$target,"$receiver: $answer°F");
+}
@@ -0,0 +1,37 @@
+if ($message =~ /^${sl}${cm}time-local$/) {
+ require POSIX;
+ my $timestamp = POSIX::strftime('%H:%M:%S',localtime);
+ actOut('MESSAGE',$target,"$receiver: $timestamp");
+}
+
+if ($message =~ /^${sl}${cm}time(-utc)?$/) {
+ require POSIX;
+ my $timestamp = POSIX::strftime('%H:%M:%S',gmtime(time));
+ actOut('MESSAGE',$target,"$receiver: $timestamp");
+}
+
+if ($message =~ /^${sl}${cm}time-unix$/) {
+ require POSIX;
+ my $timestamp = time;
+ actOut('MESSAGE',$target,"$receiver: $timestamp");
+}
+
+if ($message =~ /^${sl}${cm}time ([+-][0-9]+)$/) {
+ require POSIX;
+ my $offset = $1;
+ my $hours = POSIX::strftime('%H',gmtime(time));
+ my $minsec = POSIX::strftime('%M:%S',gmtime(time));
+ $hours += $offset;
+ if($hours > 23 || $hours < 0) { $hours = ($hours % 24); }
+ my $timestamp = $hours.':'.$minsec;
+ actOut('MESSAGE',$target,"$receiver: $timestamp");
+}
+
+if ($message =~ /^${sl}${cm}time-internet$/) {
+ require POSIX;
+ my @time_struct = gmtime(time);
+ my $seconds_into_day = ($time_struct[2] * 3600 + $time_struct[1] * 60 + $time_struct[0] + 3600) % 86400; # + 3600 because 'BMT' = UTC+1
+ $seconds_into_day = POSIX::floor($seconds_into_day); # Because printf rounds, badly
+ my $timestamp = sprintf("@%03i",$seconds_into_day * 1000 / 86400);
+ actOut('MESSAGE',$target,"$receiver: $timestamp");
+}

0 comments on commit de6ef9a

Please sign in to comment.