mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-22 18:52:40 +01:00
Adding factoid in /msg now adds factoid to default channel; replaced "all channels" with "default channel" throughout factoid command output
This commit is contained in:
parent
7aa724569e
commit
b869321eb4
@ -269,6 +269,8 @@ sub factadd {
|
||||
return "/msg $nick Usage: factadd <channel> <keyword> is <factoid>";
|
||||
}
|
||||
|
||||
$from_chan = '.*' if not $from_chan =~ m/^#/;
|
||||
|
||||
my ($channel, $trigger) = $self->{pbot}->factoids->find_factoid($from_chan, $keyword, undef, 1, 1);
|
||||
|
||||
if(defined $trigger) {
|
||||
@ -279,8 +281,8 @@ sub factadd {
|
||||
|
||||
$self->{pbot}->factoids->add_factoid('text', $from_chan, $nick, $keyword, $text);
|
||||
|
||||
$self->{pbot}->logger->log("$nick!$user\@$host added $keyword => $text\n");
|
||||
return "/msg $nick '$keyword' added.";
|
||||
$self->{pbot}->logger->log("$nick!$user\@$host added [$from_chan] $keyword => $text\n");
|
||||
return "/msg $nick '$keyword' added to " . ($from_chan eq '.*' ? 'default channel' : $from_chan) . ".";
|
||||
}
|
||||
|
||||
sub factrem {
|
||||
@ -312,7 +314,7 @@ sub factrem {
|
||||
|
||||
$self->{pbot}->logger->log("$nick!$user\@$host removed [$channel][$trigger][" . $factoids->{$channel}->{$trigger}->{action} . "]\n");
|
||||
$self->{pbot}->factoids->remove_factoid($channel, $trigger);
|
||||
return "/msg $nick $trigger removed from channel $channel.";
|
||||
return "/msg $nick $trigger removed from " . ($channel eq '.*' ? 'default channel' : $channel) . ".";
|
||||
}
|
||||
|
||||
sub histogram {
|
||||
@ -386,7 +388,7 @@ sub factinfo {
|
||||
my $created_ago = ago(gettimeofday - $factoids->{$channel}->{$trigger}->{created_on});
|
||||
my $ref_ago = ago(gettimeofday - $factoids->{$channel}->{$trigger}->{last_referenced_on}) if defined $factoids->{$channel}->{$trigger}->{last_referenced_on};
|
||||
|
||||
$chan = ($channel eq '.*' ? 'all channels' : $channel);
|
||||
$chan = ($channel eq '.*' ? 'default channel' : $channel);
|
||||
|
||||
# factoid
|
||||
if($factoids->{$channel}->{$trigger}->{type} eq 'text') {
|
||||
@ -552,7 +554,7 @@ sub factfind {
|
||||
$i++;
|
||||
|
||||
if($chan ne $last_chan) {
|
||||
$text .= $chan eq '.*' ? "[all channels] " : "[$chan] ";
|
||||
$text .= $chan eq '.*' ? "[default channel] " : "[$chan] ";
|
||||
$last_chan = $chan;
|
||||
}
|
||||
$text .= "$trigger ";
|
||||
@ -567,11 +569,11 @@ sub factfind {
|
||||
|
||||
if($i == 1) {
|
||||
chop $text;
|
||||
return "found one factoid submitted for " . ($last_chan eq '.*' ? 'all channels' : $last_chan) . " " . $argtype . ": '$last_trigger' is '" . $factoids->{$last_chan}->{$last_trigger}->{action} . "'";
|
||||
return "found one factoid submitted for " . ($last_chan eq '.*' ? 'default channel' : $last_chan) . " " . $argtype . ": '$last_trigger' is '" . $factoids->{$last_chan}->{$last_trigger}->{action} . "'";
|
||||
} else {
|
||||
return "$i factoids " . $argtype . ": $text" unless $i == 0;
|
||||
|
||||
my $chans = (defined $channel ? ($channel eq '.*' ? 'all channels' : $channel) : 'any channels');
|
||||
my $chans = (defined $channel ? ($channel eq '.*' ? 'default channel' : $channel) : 'any channels');
|
||||
return "No factoids " . $argtype . " submitted for $chans";
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ sub interpret {
|
||||
if(defined $trigger) {
|
||||
($keyword, $arguments) = ($k, "is $a");
|
||||
} else {
|
||||
($keyword, $arguments) = ("factadd", "$from $k is $a");
|
||||
($keyword, $arguments) = ("factadd", (defined $from ? $from : '.*' ) . " $k is $a");
|
||||
}
|
||||
} elsif($command =~ /^(.*?)\s+(.*)$/) {
|
||||
($keyword, $arguments) = ($1, $2);
|
||||
|
@ -13,7 +13,7 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 211,
|
||||
BUILD_REVISION => 212,
|
||||
BUILD_DATE => "2010-06-28",
|
||||
};
|
||||
|
||||
|
@ -23,28 +23,7 @@ ref_count: 2
|
||||
ref_user: pragma_
|
||||
type: text
|
||||
|
||||
<urshit>
|
||||
action: $args ur shit
|
||||
created_on: 1277371322.68472
|
||||
enabled: 1
|
||||
last_referenced_on: 1277371333.81216
|
||||
owner: hateball
|
||||
rate_limit: 15
|
||||
ref_count: 1
|
||||
ref_user: hateball
|
||||
type: text
|
||||
|
||||
[#botters]
|
||||
<excuse>
|
||||
action: lol
|
||||
created_on: 1277286675.13114
|
||||
enabled: 1
|
||||
owner: pragma_
|
||||
rate_limit: 15
|
||||
ref_count: 0
|
||||
ref_user: nobody
|
||||
type: text
|
||||
|
||||
[#pbot2]
|
||||
<test>
|
||||
action: /say This is a test in #pbot2!
|
||||
@ -10006,8 +9985,8 @@ ref_user: pragma_
|
||||
type: text
|
||||
|
||||
<version>
|
||||
action: /say PBot revision 210 2010-06-28
|
||||
created_on: 1277785832.35938
|
||||
action: /say PBot revision 212 2010-06-28
|
||||
created_on: 1277790321.9375
|
||||
enabled: 1
|
||||
last_referenced_on: 1277547370.96948
|
||||
owner: pbot3
|
||||
@ -10603,26 +10582,5 @@ ref_user: pragma_
|
||||
type: text
|
||||
|
||||
[dave0]
|
||||
<hair>
|
||||
action: as dumb as a box of hair
|
||||
created_on: 1277387092.24224
|
||||
enabled: 1
|
||||
last_referenced_on: 1277387118.69029
|
||||
owner: dave0
|
||||
rate_limit: 15
|
||||
ref_count: 1
|
||||
ref_user: dave0
|
||||
type: text
|
||||
|
||||
[poppavic]
|
||||
<##c++>
|
||||
action: For all of your C++ needs: ##C++: down the hall, left, down the stairs, ahead - next to the boiler room.
|
||||
created_on: 1277459808.85581
|
||||
enabled: 1
|
||||
owner: PoppaVic
|
||||
rate_limit: 15
|
||||
ref_count: 0
|
||||
ref_user: nobody
|
||||
type: text
|
||||
|
||||
[pragma_]
|
||||
|
Loading…
Reference in New Issue
Block a user