mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-18 08:32:43 +01:00
factoids: probably adds/remove upper/lowercase keywords
This commit is contained in:
parent
438b62552f
commit
bede029261
@ -81,7 +81,6 @@ sub add_factoid {
|
|||||||
|
|
||||||
$type = lc $type;
|
$type = lc $type;
|
||||||
$channel = lc $channel;
|
$channel = lc $channel;
|
||||||
$trigger = lc $trigger;
|
|
||||||
|
|
||||||
$self->factoids->hash->{$channel}->{$trigger}->{enabled} = 1;
|
$self->factoids->hash->{$channel}->{$trigger}->{enabled} = 1;
|
||||||
$self->factoids->hash->{$channel}->{$trigger}->{type} = $type;
|
$self->factoids->hash->{$channel}->{$trigger}->{type} = $type;
|
||||||
@ -100,7 +99,6 @@ sub remove_factoid {
|
|||||||
my ($channel, $trigger) = @_;
|
my ($channel, $trigger) = @_;
|
||||||
|
|
||||||
$channel = lc $channel;
|
$channel = lc $channel;
|
||||||
$trigger = lc $trigger;
|
|
||||||
|
|
||||||
delete $self->factoids->hash->{$channel}->{$trigger};
|
delete $self->factoids->hash->{$channel}->{$trigger};
|
||||||
$self->save_factoids;
|
$self->save_factoids;
|
||||||
@ -164,11 +162,7 @@ sub find_factoid {
|
|||||||
|
|
||||||
my @result = eval {
|
my @result = eval {
|
||||||
foreach my $channel (sort keys %{ $self->factoids->hash }) {
|
foreach my $channel (sort keys %{ $self->factoids->hash }) {
|
||||||
if($exact_channel) {
|
next unless lc $from eq lc $channel;
|
||||||
next unless $from eq $channel;
|
|
||||||
} else {
|
|
||||||
next unless $from =~ m/^$channel$/i;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $trigger (keys %{ $self->factoids->hash->{$channel} }) {
|
foreach my $trigger (keys %{ $self->factoids->hash->{$channel} }) {
|
||||||
if(not $exact_trigger and $self->factoids->hash->{$channel}->{$trigger}->{type} eq 'regex') {
|
if(not $exact_trigger and $self->factoids->hash->{$channel}->{$trigger}->{type} eq 'regex') {
|
||||||
@ -324,8 +318,6 @@ sub interpreter {
|
|||||||
$self->factoids->hash->{$channel}->{$keyword}->{last_referenced_on} = gettimeofday;
|
$self->factoids->hash->{$channel}->{$keyword}->{last_referenced_on} = gettimeofday;
|
||||||
$self->factoids->hash->{$channel}->{$keyword}->{last_referenced_in} = $from || "stdin";
|
$self->factoids->hash->{$channel}->{$keyword}->{last_referenced_in} = $from || "stdin";
|
||||||
|
|
||||||
$self->{pbot}->logger->log("(" . (defined $from ? $from : "(undef)") . "): $nick!$user\@$host): $keyword: Displaying text \"" . $self->factoids->hash->{$channel}->{$keyword}->{action} . "\"\n");
|
|
||||||
|
|
||||||
if(defined $tonick) { # !tell foo about bar
|
if(defined $tonick) { # !tell foo about bar
|
||||||
$self->{pbot}->logger->log("($from): $nick!$user\@$host) sent to $tonick\n");
|
$self->{pbot}->logger->log("($from): $nick!$user\@$host) sent to $tonick\n");
|
||||||
my $fromnick = $self->{pbot}->admins->loggedin($from, "$nick!$user\@$host") ? "" : "$nick wants you to know: ";
|
my $fromnick = $self->{pbot}->admins->loggedin($from, "$nick!$user\@$host") ? "" : "$nick wants you to know: ";
|
||||||
@ -369,6 +361,8 @@ sub interpreter {
|
|||||||
$result =~ s/\$args/$nick/gi;
|
$result =~ s/\$args/$nick/gi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->{pbot}->logger->log("(" . (defined $from ? $from : "(undef)") . "): $nick!$user\@$host): $keyword: Displaying text \"" . $self->factoids->hash->{$channel}->{$keyword}->{action} . "\"\n");
|
||||||
|
|
||||||
$result =~ s/\$nick/$nick/g;
|
$result =~ s/\$nick/$nick/g;
|
||||||
|
|
||||||
while ($result =~ /[^\\]\$([a-zA-Z0-9_\-]+)/g) {
|
while ($result =~ /[^\\]\$([a-zA-Z0-9_\-]+)/g) {
|
||||||
|
@ -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 => 318,
|
BUILD_REVISION => 319,
|
||||||
BUILD_DATE => "2011-02-13",
|
BUILD_DATE => "2011-02-13",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user