3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

Allow quote grabbers to delete their own grabs

This commit is contained in:
Pragmatic Software 2013-10-26 02:39:54 +00:00
parent b7b9ce76ca
commit 274193bed7
3 changed files with 10 additions and 2 deletions

View File

@ -4,6 +4,9 @@
# Purpose: Keeps track of who has said what and when. Used in
# conjunction with ChanOps and Quotegrabs for kick/ban on flood
# and grabbing quotes, respectively.
#
# We should take out the message-tracking stuff and put it in its own
# MessageTracker class.
package PBot::AntiFlood;

View File

@ -50,7 +50,7 @@ sub initialize {
#-------------------------------------------------------------------------------------
$pbot->commands->register(sub { $self->grab_quotegrab(@_) }, "grab", 0);
$pbot->commands->register(sub { $self->show_quotegrab(@_) }, "getq", 0);
$pbot->commands->register(sub { $self->delete_quotegrab(@_) }, "delq", 10);
$pbot->commands->register(sub { $self->delete_quotegrab(@_) }, "delq", 0);
$pbot->commands->register(sub { $self->show_random_quotegrab(@_) }, "rq", 0);
}
@ -356,6 +356,11 @@ sub delete_quotegrab {
}
my $quotegrab = $self->{quotegrabs}[$arguments - 1];
if(not $self->{pbot}->admins->loggedin($from, "$nick!$user\@$host") and $quotegrab->{grabbed_by} ne "$nick!$user\@$host") {
return "You are not the grabber of this quote.";
}
splice @{ $self->{quotegrabs} }, $arguments - 1, 1;
for(my $i = $arguments - 1; $i <= $#{ $self->{quotegrabs} }; $i++ ) {

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 458,
BUILD_REVISION => 459,
BUILD_DATE => "2013-10-25",
};