mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Remove secretstuff; use $stuff context instead
This commit is contained in:
parent
efb53e397f
commit
7b903854a3
@ -971,12 +971,15 @@ sub handle_action {
|
|||||||
return $action;
|
return $action;
|
||||||
} elsif ($action =~ s/^\/kick\s+//) {
|
} elsif ($action =~ s/^\/kick\s+//) {
|
||||||
if (not exists $self->{factoids}->hash->{$channel}->{$keyword}->{'effective-level'}) {
|
if (not exists $self->{factoids}->hash->{$channel}->{$keyword}->{'effective-level'}) {
|
||||||
|
$stuff->{authorized} = 0;
|
||||||
return "/say $stuff->{nick}: $keyword doesn't have the effective-level to do that.";
|
return "/say $stuff->{nick}: $keyword doesn't have the effective-level to do that.";
|
||||||
}
|
}
|
||||||
my $level = 10;
|
my $level = 10;
|
||||||
if ($self->{factoids}->hash->{$channel}->{$keyword}->{'effective-level'} >= $level) {
|
if ($self->{factoids}->hash->{$channel}->{$keyword}->{'effective-level'} >= $level) {
|
||||||
return "/$self->{pbot}->{secretstuff}kick " . $action;
|
$stuff->{authorized} = 1;
|
||||||
|
return "/kick " . $action;
|
||||||
} else {
|
} else {
|
||||||
|
$stuff->{authorized} = 0;
|
||||||
return "/say $stuff->{nick}: My effective-level isn't high enough to do that.";
|
return "/say $stuff->{nick}: My effective-level isn't high enough to do that.";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -471,15 +471,12 @@ sub output_result {
|
|||||||
return if not defined $line or not length $line;
|
return if not defined $line or not length $line;
|
||||||
|
|
||||||
if ($line =~ s/^\/say\s+//i) {
|
if ($line =~ s/^\/say\s+//i) {
|
||||||
$line =~ s/\Q$self->{pbot}->{secretstuff}\E//g;
|
|
||||||
$pbot->{conn}->privmsg($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
$pbot->{conn}->privmsg($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
||||||
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', $line, 0, 0, 0) if $stuff->{checkflood};
|
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', $line, 0, 0, 0) if $stuff->{checkflood};
|
||||||
} elsif ($line =~ s/^\/me\s+//i) {
|
} elsif ($line =~ s/^\/me\s+//i) {
|
||||||
$line =~ s/\Q$self->{pbot}->{secretstuff}\E//g;
|
|
||||||
$pbot->{conn}->me($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
$pbot->{conn}->me($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
||||||
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', '/me ' . $line, 0, 0, 0) if $stuff->{checkflood};
|
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', '/me ' . $line, 0, 0, 0) if $stuff->{checkflood};
|
||||||
} elsif ($line =~ s/^\/msg\s+([^\s]+)\s+//i) {
|
} elsif ($line =~ s/^\/msg\s+([^\s]+)\s+//i) {
|
||||||
$line =~ s/\Q$self->{pbot}->{secretstuff}\E//g;
|
|
||||||
my $to = $1;
|
my $to = $1;
|
||||||
if ($to =~ /,/) {
|
if ($to =~ /,/) {
|
||||||
$pbot->{logger}->log("[HACK] Possible HACK ATTEMPT /msg multiple users: [$stuff->{nick}!$stuff->{user}\@$stuff->{host}] [$stuff->{command}] [$line]\n");
|
$pbot->{logger}->log("[HACK] Possible HACK ATTEMPT /msg multiple users: [$stuff->{nick}!$stuff->{user}\@$stuff->{host}] [$stuff->{command}] [$line]\n");
|
||||||
@ -493,7 +490,7 @@ sub output_result {
|
|||||||
$pbot->{conn}->privmsg($to, $line) if $to !~ /\Q$botnick\E/i;
|
$pbot->{conn}->privmsg($to, $line) if $to !~ /\Q$botnick\E/i;
|
||||||
$pbot->{antiflood}->check_flood($to, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', $line, 0, 0, 0) if $stuff->{checkflood};
|
$pbot->{antiflood}->check_flood($to, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', $line, 0, 0, 0) if $stuff->{checkflood};
|
||||||
}
|
}
|
||||||
} elsif ($line =~ s/^\/$self->{pbot}->{secretstuff}kick\s+//) {
|
} elsif ($stuff->{authorized} && $line =~ s/^\/kick\s+//) {
|
||||||
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', '/kick ' . $line, 0, 0, 0) if $stuff->{checkflood};
|
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', '/kick ' . $line, 0, 0, 0) if $stuff->{checkflood};
|
||||||
my ($victim, $reason) = split /\s+/, $line, 2;
|
my ($victim, $reason) = split /\s+/, $line, 2;
|
||||||
|
|
||||||
@ -515,7 +512,6 @@ sub output_result {
|
|||||||
$pbot->{conn}->privmsg($stuff->{from}, "$victim: $reason") if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
$pbot->{conn}->privmsg($stuff->{from}, "$victim: $reason") if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$line =~ s/\Q$self->{pbot}->{secretstuff}\E//g;
|
|
||||||
$pbot->{conn}->privmsg($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
$pbot->{conn}->privmsg($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} !~ /\Q$botnick\E/i;
|
||||||
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', $line, 0, 0, 0) if $stuff->{checkflood};
|
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', $line, 0, 0, 0) if $stuff->{checkflood};
|
||||||
}
|
}
|
||||||
|
@ -146,9 +146,6 @@ sub initialize {
|
|||||||
$self->{registry}->load;
|
$self->{registry}->load;
|
||||||
}
|
}
|
||||||
|
|
||||||
my @chars = ("A".."Z", "a".."z", "0".."9");
|
|
||||||
$self->{secretstuff} .= $chars[rand @chars] for 1..64;
|
|
||||||
|
|
||||||
# create implicit bot-admin account for bot
|
# create implicit bot-admin account for bot
|
||||||
my $botnick = $self->{registry}->get_value('irc', 'botnick');
|
my $botnick = $self->{registry}->get_value('irc', 'botnick');
|
||||||
$self->{admins}->add_admin($botnick, '.*', "$botnick!stdin\@localhost", 90, 'admin', 1);
|
$self->{admins}->add_admin($botnick, '.*', "$botnick!stdin\@localhost", 90, 'admin', 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user