mirror of
https://github.com/pragma-/pbot.git
synced 2025-05-03 13:17:33 +02:00
Allow quote grabbers to delete their own grabs
This commit is contained in:
parent
b7b9ce76ca
commit
274193bed7
@ -4,6 +4,9 @@
|
|||||||
# Purpose: Keeps track of who has said what and when. Used in
|
# Purpose: Keeps track of who has said what and when. Used in
|
||||||
# conjunction with ChanOps and Quotegrabs for kick/ban on flood
|
# conjunction with ChanOps and Quotegrabs for kick/ban on flood
|
||||||
# and grabbing quotes, respectively.
|
# and grabbing quotes, respectively.
|
||||||
|
#
|
||||||
|
# We should take out the message-tracking stuff and put it in its own
|
||||||
|
# MessageTracker class.
|
||||||
|
|
||||||
package PBot::AntiFlood;
|
package PBot::AntiFlood;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ sub initialize {
|
|||||||
#-------------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------------
|
||||||
$pbot->commands->register(sub { $self->grab_quotegrab(@_) }, "grab", 0);
|
$pbot->commands->register(sub { $self->grab_quotegrab(@_) }, "grab", 0);
|
||||||
$pbot->commands->register(sub { $self->show_quotegrab(@_) }, "getq", 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);
|
$pbot->commands->register(sub { $self->show_random_quotegrab(@_) }, "rq", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +356,11 @@ sub delete_quotegrab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $quotegrab = $self->{quotegrabs}[$arguments - 1];
|
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;
|
splice @{ $self->{quotegrabs} }, $arguments - 1, 1;
|
||||||
|
|
||||||
for(my $i = $arguments - 1; $i <= $#{ $self->{quotegrabs} }; $i++ ) {
|
for(my $i = $arguments - 1; $i <= $#{ $self->{quotegrabs} }; $i++ ) {
|
||||||
|
@ -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 => 458,
|
BUILD_REVISION => 459,
|
||||||
BUILD_DATE => "2013-10-25",
|
BUILD_DATE => "2013-10-25",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user