3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 11:42:35 +01:00

Grab most recent quote by regex instead of oldest first

This commit is contained in:
Pragmatic Software 2012-08-01 11:06:01 +00:00
parent 876d9fb5c6
commit cb770d81ac
3 changed files with 6 additions and 5 deletions

View File

@ -45,6 +45,7 @@ sub initialize {
$pbot->commands->register(sub { return $self->adminset(@_) }, "adminset", 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->export(@_) }, "export", 60);
}
sub sl {
@ -167,7 +168,7 @@ sub export {
my ($from, $nick, $user, $host, $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) {

View File

@ -211,15 +211,15 @@ sub grab_quotegrab {
} else {
# regex history
my $ret = eval {
my $i = 0;
my $i = $#messages;
my $found = 0;
while($i <= $#messages) {
while($i >= 0) {
if($messages[$i]->{msg} =~ m/$grab_history/i) {
$grab_history = $i;
$found = 1;
last;
}
$i++;
$i--;
}
if($found == 0) {

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 371,
BUILD_REVISION => 372,
BUILD_DATE => "2012-08-01",
};