return 'addressedother set' if ($addressedother);
$talkok = ($param{'addressing'} =~ /^OPTIONAL$/i or $addressed);
- $learnok = ($param{'learn'} =~ /^HUNGRY$/i or $addressed);
+ $learnok = 1 if ($addressed);
+ if ($param{'learn'} =~ /^HUNGRY$/i) {
+ $learnok = 1;
+ $addressed = 1;
+ $talkok = 1;
+ }
&shmFlush(); # hack.
return;
}
+ if ($thischan !~ /^$mask{chan}$/) {
+ &msg($who, "$thischan is not a valid channel name.");
+ return;
+ }
+
if (&IsFlag("o") ne "o") {
if (!exists $chanconf{$thischan}) {
&msg($who, "I am not allowed to join $thischan.");
}
if (&validChan($thischan)) {
- &msg($who,"warn: I'm already on $thischan, joining anyway...");
-# return;
+ &msg($who,"warn: I'm already on $thischan, joining anyway...");
}
}
$cache{join}{$thischan} = $who; # used for on_join self.
# greetings.
if ($message =~ /how (the hell )?are (ya|you)( doin\'?g?)?\?*$/) {
- my $reply = &getRandom(keys %{ $lang{'howareyou'} });
- &performReply($reply);
-
+ &performReply(&getRandom(keys %{ $lang{'howareyou'} }));
return;
}
{
return 'praise: no addr' unless ($addressed);
- &status("random praise detected");
-
- my $tmp = (rand() < 0.5) ? "thanks $who " : "";
- &pSReply($tmp.":)");
-
+ &performReply(&getRandom(keys %{ $lang{'praise'} }));
return;
}
###
# karma. set...
- if ($message =~ /^(\S+)(--|\+\+)\s*$/ and $addressed) {
- return '' unless (&hasParam("karma"));
- # well... since it is policy to do bot functions before factoids
- # karma gets hit if, for example, "g++" is issued.
- # only way to request it is to put a question mark at the end.
-
- my($term,$inc) = (lc $1,$2);
-
- if ($msgType !~ /public/i) {
- &msg($who, "karma must be done in public!");
- return;
- }
+ if ($msgType =~ /public/i && $message =~ /^(\S+)(--|\+\+)\s*$/ &&
+ $addressed && &hasParam("karma")
+ ) {
+ # to request factoids such as "g++" or "libstdc++", append "?" to the query.
+ my ($term,$inc) = (lc $1,$2);
if (lc $term eq lc $who) {
&msg($who, "please don't karma yourself");
$karma--;
}
- &sqlSet("stats",
- { nick => $term, type => "karma" }, # WHERE
-# { counter => $karma } # WHAT
- { -counter => "counter+1" }
- );
+ &sqlReplace("stats", {
+ nick => $term,
+ type => "karma",
+ 'time' => time(),
+ counter => $karma,
+ } );
return;
}
}
}
- if (&IsParam("factoids") and $param{'DBType'} =~ /^(mysql|sqlite|pgsql|dbm)/i) {
+ if (&IsParam("factoids") and $param{'DBType'} =~ /^(mysql|sqlite|pgsql)/i) {
&FactoidStuff();
} elsif ($param{'DBType'} =~ /^none$/i) {
return "NO FACTOIDS.";