mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 03:02:47 +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>";
|
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);
|
my ($channel, $trigger) = $self->{pbot}->factoids->find_factoid($from_chan, $keyword, undef, 1, 1);
|
||||||
|
|
||||||
if(defined $trigger) {
|
if(defined $trigger) {
|
||||||
@ -279,8 +281,8 @@ sub factadd {
|
|||||||
|
|
||||||
$self->{pbot}->factoids->add_factoid('text', $from_chan, $nick, $keyword, $text);
|
$self->{pbot}->factoids->add_factoid('text', $from_chan, $nick, $keyword, $text);
|
||||||
|
|
||||||
$self->{pbot}->logger->log("$nick!$user\@$host added $keyword => $text\n");
|
$self->{pbot}->logger->log("$nick!$user\@$host added [$from_chan] $keyword => $text\n");
|
||||||
return "/msg $nick '$keyword' added.";
|
return "/msg $nick '$keyword' added to " . ($from_chan eq '.*' ? 'default channel' : $from_chan) . ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub factrem {
|
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}->logger->log("$nick!$user\@$host removed [$channel][$trigger][" . $factoids->{$channel}->{$trigger}->{action} . "]\n");
|
||||||
$self->{pbot}->factoids->remove_factoid($channel, $trigger);
|
$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 {
|
sub histogram {
|
||||||
@ -386,7 +388,7 @@ sub factinfo {
|
|||||||
my $created_ago = ago(gettimeofday - $factoids->{$channel}->{$trigger}->{created_on});
|
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};
|
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
|
# factoid
|
||||||
if($factoids->{$channel}->{$trigger}->{type} eq 'text') {
|
if($factoids->{$channel}->{$trigger}->{type} eq 'text') {
|
||||||
@ -552,7 +554,7 @@ sub factfind {
|
|||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
if($chan ne $last_chan) {
|
if($chan ne $last_chan) {
|
||||||
$text .= $chan eq '.*' ? "[all channels] " : "[$chan] ";
|
$text .= $chan eq '.*' ? "[default channel] " : "[$chan] ";
|
||||||
$last_chan = $chan;
|
$last_chan = $chan;
|
||||||
}
|
}
|
||||||
$text .= "$trigger ";
|
$text .= "$trigger ";
|
||||||
@ -567,11 +569,11 @@ sub factfind {
|
|||||||
|
|
||||||
if($i == 1) {
|
if($i == 1) {
|
||||||
chop $text;
|
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 {
|
} else {
|
||||||
return "$i factoids " . $argtype . ": $text" unless $i == 0;
|
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";
|
return "No factoids " . $argtype . " submitted for $chans";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ sub interpret {
|
|||||||
if(defined $trigger) {
|
if(defined $trigger) {
|
||||||
($keyword, $arguments) = ($k, "is $a");
|
($keyword, $arguments) = ($k, "is $a");
|
||||||
} else {
|
} else {
|
||||||
($keyword, $arguments) = ("factadd", "$from $k is $a");
|
($keyword, $arguments) = ("factadd", (defined $from ? $from : '.*' ) . " $k is $a");
|
||||||
}
|
}
|
||||||
} elsif($command =~ /^(.*?)\s+(.*)$/) {
|
} elsif($command =~ /^(.*?)\s+(.*)$/) {
|
||||||
($keyword, $arguments) = ($1, $2);
|
($keyword, $arguments) = ($1, $2);
|
||||||
|
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 211,
|
BUILD_REVISION => 212,
|
||||||
BUILD_DATE => "2010-06-28",
|
BUILD_DATE => "2010-06-28",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,28 +23,7 @@ ref_count: 2
|
|||||||
ref_user: pragma_
|
ref_user: pragma_
|
||||||
type: text
|
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]
|
[#botters]
|
||||||
<excuse>
|
|
||||||
action: lol
|
|
||||||
created_on: 1277286675.13114
|
|
||||||
enabled: 1
|
|
||||||
owner: pragma_
|
|
||||||
rate_limit: 15
|
|
||||||
ref_count: 0
|
|
||||||
ref_user: nobody
|
|
||||||
type: text
|
|
||||||
|
|
||||||
[#pbot2]
|
[#pbot2]
|
||||||
<test>
|
<test>
|
||||||
action: /say This is a test in #pbot2!
|
action: /say This is a test in #pbot2!
|
||||||
@ -10006,8 +9985,8 @@ ref_user: pragma_
|
|||||||
type: text
|
type: text
|
||||||
|
|
||||||
<version>
|
<version>
|
||||||
action: /say PBot revision 210 2010-06-28
|
action: /say PBot revision 212 2010-06-28
|
||||||
created_on: 1277785832.35938
|
created_on: 1277790321.9375
|
||||||
enabled: 1
|
enabled: 1
|
||||||
last_referenced_on: 1277547370.96948
|
last_referenced_on: 1277547370.96948
|
||||||
owner: pbot3
|
owner: pbot3
|
||||||
@ -10603,26 +10582,5 @@ ref_user: pragma_
|
|||||||
type: text
|
type: text
|
||||||
|
|
||||||
[dave0]
|
[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]
|
[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_]
|
[pragma_]
|
||||||
|
Loading…
Reference in New Issue
Block a user