mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 03:33:06 +01:00
Ensure admins actually have rights in $channel to use $command
This commit is contained in:
parent
9e24f43ff7
commit
1172d7b262
@ -82,6 +82,10 @@ sub ban_user {
|
||||
my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick');
|
||||
return "I don't think so." if $target =~ /^\Q$botnick\E!/i;
|
||||
|
||||
if (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
|
||||
return "/msg $nick You are not an admin for $channel.";
|
||||
}
|
||||
|
||||
$self->{pbot}->{chanops}->ban_user_timed($target, $channel, $length);
|
||||
|
||||
if ($length > 0) {
|
||||
@ -112,6 +116,10 @@ sub unban_user {
|
||||
|
||||
return "/msg $nick Usage for /msg: unban <nick/mask> <channel>" if $channel !~ /^#/;
|
||||
|
||||
if (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
|
||||
return "/msg $nick You are not an admin for $channel.";
|
||||
}
|
||||
|
||||
$self->{pbot}->{chanops}->unban_user($target, $channel, 1);
|
||||
return "/msg $nick $target has been unbanned from $channel.";
|
||||
}
|
||||
@ -157,6 +165,10 @@ sub mute_user {
|
||||
my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick');
|
||||
return "I don't think so." if $target =~ /^\Q$botnick\E!/i;
|
||||
|
||||
if (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
|
||||
return "/msg $nick You are not an admin for $channel.";
|
||||
}
|
||||
|
||||
$self->{pbot}->{chanops}->mute_user_timed($target, $channel, $length);
|
||||
|
||||
if ($length > 0) {
|
||||
@ -187,6 +199,10 @@ sub unmute_user {
|
||||
|
||||
return "/msg $nick Usage for /msg: unmute <mask> <channel>" if $channel !~ /^#/;
|
||||
|
||||
if (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
|
||||
return "/msg $nick You are not an admin for $channel.";
|
||||
}
|
||||
|
||||
$self->{pbot}->{chanops}->unmute_user($target, $channel, 1);
|
||||
return "/msg $nick $target has been unmuted in $channel.";
|
||||
}
|
||||
@ -230,6 +246,10 @@ sub kick_user {
|
||||
}
|
||||
}
|
||||
|
||||
if (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
|
||||
return "/msg $nick You are not an admin for $channel.";
|
||||
}
|
||||
|
||||
$self->{pbot}->{chanops}->add_op_command($channel, "kick $channel $victim $reason");
|
||||
$self->{pbot}->{chanops}->gain_ops($channel);
|
||||
return "";
|
||||
|
Loading…
Reference in New Issue
Block a user