mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Grab most recent quote by regex instead of oldest first
This commit is contained in:
parent
876d9fb5c6
commit
cb770d81ac
@ -45,6 +45,7 @@ sub initialize {
|
|||||||
$pbot->commands->register(sub { return $self->adminset(@_) }, "adminset", 60);
|
$pbot->commands->register(sub { return $self->adminset(@_) }, "adminset", 60);
|
||||||
$pbot->commands->register(sub { return $self->adminunset(@_) }, "adminunset", 60);
|
$pbot->commands->register(sub { return $self->adminunset(@_) }, "adminunset", 60);
|
||||||
$pbot->commands->register(sub { return $self->sl(@_) }, "sl", 60);
|
$pbot->commands->register(sub { return $self->sl(@_) }, "sl", 60);
|
||||||
|
$pbot->commands->register(sub { return $self->export(@_) }, "export", 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub sl {
|
sub sl {
|
||||||
@ -167,7 +168,7 @@ sub export {
|
|||||||
my ($from, $nick, $user, $host, $arguments) = @_;
|
my ($from, $nick, $user, $host, $arguments) = @_;
|
||||||
|
|
||||||
if(not defined $arguments) {
|
if(not defined $arguments) {
|
||||||
return "/msg $nick Usage: export <modules|factoids|admins>";
|
return "/msg $nick Usage: export <modules|factoids|admins|quotegrabs>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($arguments =~ /^modules$/i) {
|
if($arguments =~ /^modules$/i) {
|
||||||
|
@ -211,15 +211,15 @@ sub grab_quotegrab {
|
|||||||
} else {
|
} else {
|
||||||
# regex history
|
# regex history
|
||||||
my $ret = eval {
|
my $ret = eval {
|
||||||
my $i = 0;
|
my $i = $#messages;
|
||||||
my $found = 0;
|
my $found = 0;
|
||||||
while($i <= $#messages) {
|
while($i >= 0) {
|
||||||
if($messages[$i]->{msg} =~ m/$grab_history/i) {
|
if($messages[$i]->{msg} =~ m/$grab_history/i) {
|
||||||
$grab_history = $i;
|
$grab_history = $i;
|
||||||
$found = 1;
|
$found = 1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
$i++;
|
$i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($found == 0) {
|
if($found == 0) {
|
||||||
|
@ -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 => 371,
|
BUILD_REVISION => 372,
|
||||||
BUILD_DATE => "2012-08-01",
|
BUILD_DATE => "2012-08-01",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user