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

Tidy things up

This commit is contained in:
Pragmatic Software 2020-02-16 08:41:45 -08:00
parent c95fbd9ca0
commit a6b2f60175
15 changed files with 2 additions and 44 deletions

View File

@ -584,7 +584,6 @@ sub unbanme {
}
if (keys %$unbanned) {
my $channels = '';
my $sep = '';
@ -596,7 +595,6 @@ sub unbanme {
foreach my $channel (keys %$unbanned) {
foreach my $mask (keys %{$unbanned->{$channel}}) {
if ($self->{pbot}->{channels}->is_active_op("${channel}-floodbans")) {
if ($unbanned->{$channel}->{$mask} <= 2) {
$self->{pbot}->{chanops}->unban_user($mask, $channel . '-floodbans');
$channels .= "$sep$channel";

View File

@ -55,7 +55,6 @@ sub get_banlist {
}
sub on_banlist_entry {
my ($self, $event_type, $event) = @_;
my $channel = lc $event->{event}->{args}[1];
@ -91,7 +90,6 @@ sub on_banlist_entry {
}
sub on_quietlist_entry {
my ($self, $event_type, $event) = @_;
my $channel = lc $event->{event}->{args}[1];

View File

@ -234,7 +234,6 @@ sub checkban {
my $mask = $self->nick_to_banmask($target);
if ($self->{unban_timeout}->exists($channel, $mask)) {
my $timeout = $self->{unban_timeout}->get_data($channel, $mask, 'timeout');
my $owner = $self->{unban_timeout}->get_data($channel, $mask, 'owner');
my $reason = $self->{unban_timeout}->get_data($channel, $mask, 'reason');
@ -288,7 +287,6 @@ sub checkmute {
my $mask = $self->nick_to_banmask($target);
if ($self->{unmute_timeout}->exists($channel, $mask)) {
my $timeout = $self->{unmute_timeout}->get_data($channel, $mask, 'timeout');
my $owner = $self->{unmute_timeout}->get_data($channel, $mask, 'owner');
my $reason = $self->{unmute_timeout}->get_data($channel, $mask, 'reason');

View File

@ -301,7 +301,6 @@ sub list_undo_history {
}
sub factundo {
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
my $usage = "Usage: factundo [-l [N]] [-r N] [channel] <keyword> (-l list undo history, optionally starting from N; -r jump to revision N)";
@ -400,7 +399,6 @@ sub factundo {
}
sub factredo {
my $self = shift;
my ($from, $nick, $user, $host, $arguments) = @_;
@ -916,7 +914,6 @@ sub factrem {
}
sub histogram {
my $self = shift;
my ($from, $nick, $user, $host, $arguments) = @_;
my $factoids = $self->{pbot}->{factoids}->{factoids};
@ -1160,7 +1157,6 @@ sub factinfo {
}
sub top20 {
my $self = shift;
my ($from, $nick, $user, $host, $arguments, $stuff) = @_;
@ -1228,7 +1224,6 @@ sub top20 {
}
sub count {
my $self = shift;
my ($from, $nick, $user, $host, $arguments) = @_;
my $factoids = $self->{pbot}->{factoids}->{factoids};

View File

@ -371,7 +371,6 @@ sub expand_special_vars {
}
sub expand_factoid_vars {
my ($self, $stuff, @exclude) = @_;
my $from = length $stuff->{ref_from} ? $stuff->{ref_from} : $stuff->{from};
@ -610,7 +609,6 @@ sub expand_action_arguments {
if ($@) { next; }
else {
if (not defined $value) {
if ($arg == 0) { $action =~ s/\$\{arg\[$arg\]\}/$nick/ || $action =~ s/\$arg\[$arg\]/$nick/; }
else { $action =~ s/\s*\$\{arg\[$arg\]\}// || $action =~ s/\s*\$arg\[$arg\]//; }
@ -702,7 +700,6 @@ sub interpreter {
# if no match found, attempt to call factoid from another channel if it exists there
if (not defined $keyword) {
my $string = "$original_keyword $stuff->{arguments}";
my $lc_keyword = lc $original_keyword;

View File

@ -133,7 +133,6 @@ sub on_self_part {
}
sub on_public {
my ($self, $event_type, $event) = @_;
my $from = $event->{event}->{to}[0];
@ -149,7 +148,6 @@ sub on_public {
}
sub on_msg {
my ($self, $event_type, $event) = @_;
my ($nick, $host) = ($event->{event}->nick, $event->{event}->host);
my $text = $event->{event}->{args}[0];

View File

@ -913,13 +913,6 @@ sub output_result {
$pbot->{conn}->privmsg($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} ne $botnick;
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'pbot', $line, 0, 0, 0) if $stuff->{checkflood};
} elsif ($line =~ s/^\/me\s+//i) {
=cut
if (defined $stuff->{nickoverride}) {
$line = "$line (for $stuff->{nickoverride})";
}
=cut
$pbot->{conn}->me($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} ne $botnick;
$pbot->{antiflood}->check_flood($stuff->{from}, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'pbot', '/me ' . $line, 0, 0, 0) if $stuff->{checkflood};
} elsif ($line =~ s/^\/msg\s+([^\s]+)\s+//i) {
@ -929,13 +922,6 @@ sub output_result {
} elsif ($to =~ /.*serv(?:@.*)?$/i) {
$pbot->{logger}->log("[HACK] Possible HACK ATTEMPT /msg *serv: [$stuff->{nick}!$stuff->{user}\@$stuff->{host}] [$stuff->{command}] [$line]\n");
} elsif ($line =~ s/^\/me\s+//i) {
=cut
if (defined $stuff->{nickoverride}) {
$line = "$line (for $stuff->{nickoverride})";
}
=cut
$pbot->{conn}->me($to, $line) if $to ne $botnick;
$pbot->{antiflood}->check_flood($to, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'pbot', '/me ' . $line, 0, 0, 0) if $stuff->{checkflood};
} else {

View File

@ -684,9 +684,7 @@ sub get_message_account {
if (defined $rows->[0] and not defined $orig_nick) {
if ($link_type == $self->{alias_type}->{STRONG}) {
my $host1 = lc "$nick!$user\@$host";
my $host2 = lc $rows->[0]->{hostmask};
my ($nick1) = $host1 =~ m/^([^!]+)!/;
my ($nick2) = $host2 =~ m/^([^!]+)!/;

View File

@ -743,7 +743,6 @@ sub bomb {
}
sub show_scoreboard {
my ($self) = @_;
my $buf;

View File

@ -1427,7 +1427,6 @@ sub normalize_text {
}
sub validate_lie {
my ($self, $truth, $lie) = @_;
my %truth_words = @{stem map { $_ => 1 } grep { /^\w+$/ and not exists $self->{stopwords}{lc $_} } split /\b/, $truth};
@ -1923,7 +1922,6 @@ sub showlies {
}
if (@liars) {
my $liars_text = '';
my $liars_no_apostrophe = '';
my $lie = $player->{truth};
@ -1972,7 +1970,6 @@ sub showtruth {
my ($self, $state) = @_;
if ($state->{ticks} % 3 == 0) {
my $player_id;
my $player_data;
my $players;
@ -2069,7 +2066,6 @@ sub showfinalscore {
my ($self, $state) = @_;
if ($state->{newstate}) {
my $player_id;
my $player_data;

View File

@ -51,7 +51,6 @@ sub on_public {
if ($msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*?)(?<!\\)${sep}([g]*).*$/ or $msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*)$/) {
my ($regex, $replacement, $modifiers) = ($1, $2, $3);
eval {
my $rx = qr/$regex/;
my $messages = $self->{pbot}->{messagehistory}->{database}->get_recent_messages_from_channel($channel, 50, $self->{pbot}->{messagehistory}->{MSG_CHAT}, 'DESC');

View File

@ -56,7 +56,6 @@ sub show_url_titles {
and not grep { $channel =~ /$_/i } $self->{pbot}->{registry}->get_value('general', 'show_url_titles_ignore_channels')
and grep { $channel =~ /$_/i } $self->{pbot}->{registry}->get_value('general', 'show_url_titles_channels'))
{
my $count = 0;
while ($msg =~ s/(https?:\/\/[^\s]+)//i && ++$count <= 3) {
my $url = $1;

View File

@ -61,7 +61,6 @@ sub weathercmd {
}
sub get_weather {
my ($self, $location) = @_;
my %cache_opt = (

View File

@ -35,7 +35,6 @@ sub unload {
}
sub wttrcmd {
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
my @wttr_options = (
@ -103,7 +102,6 @@ sub wttrcmd {
}
sub get_wttr {
my ($self, $location, %options) = @_;
my %cache_opt = (

4
misc/update-version vendored
View File

@ -19,11 +19,11 @@ $rev++;
print "New version: $rev $date\n";
open my $in, '<', "../PBot/VERSION.pm" or die "Couldn't open VERSION.pm for reading: $!";
open my $in, '<', "PBot/VERSION.pm" or die "Couldn't open VERSION.pm for reading: $!";
my @lines = <$in>;
close $in;
open my $out, '>', "../PBot/VERSION.pm" or die "Couldn't open VERSION.pm for writing: $!";
open my $out, '>', "PBot/VERSION.pm" or die "Couldn't open VERSION.pm for writing: $!";
foreach my $text (@lines) {
$text =~ s/BUILD_NAME\s+=> ".*",/BUILD_NAME => "PBot",/;