From a6b2f6017537e08dd725bf5c679de150044e23e8 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 16 Feb 2020 08:41:45 -0800 Subject: [PATCH] Tidy things up --- PBot/AntiFlood.pm | 2 -- PBot/BanTracker.pm | 2 -- PBot/ChanOps.pm | 2 -- PBot/FactoidCommands.pm | 5 ----- PBot/Factoids.pm | 3 --- PBot/IRCHandlers.pm | 2 -- PBot/Interpreter.pm | 14 -------------- PBot/MessageHistory_SQLite.pm | 2 -- Plugins/Battleship.pm | 1 - Plugins/Spinach.pm | 4 ---- Plugins/TypoSub.pm | 1 - Plugins/UrlTitles.pm | 1 - Plugins/Weather.pm | 1 - Plugins/Wttr.pm | 2 -- misc/update-version | 4 ++-- 15 files changed, 2 insertions(+), 44 deletions(-) diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index 067ab39d..d88831c9 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -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"; diff --git a/PBot/BanTracker.pm b/PBot/BanTracker.pm index 7ab68790..9a793e9f 100644 --- a/PBot/BanTracker.pm +++ b/PBot/BanTracker.pm @@ -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]; diff --git a/PBot/ChanOps.pm b/PBot/ChanOps.pm index b0ccdacd..543cadf7 100644 --- a/PBot/ChanOps.pm +++ b/PBot/ChanOps.pm @@ -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'); diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index 371daf52..90fbb725 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -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] (-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}; diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 35c0ca9d..9c516c88 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -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; diff --git a/PBot/IRCHandlers.pm b/PBot/IRCHandlers.pm index 174ba6cf..8a889332 100644 --- a/PBot/IRCHandlers.pm +++ b/PBot/IRCHandlers.pm @@ -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]; diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index 229ebfb5..5fdd6fda 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -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 { diff --git a/PBot/MessageHistory_SQLite.pm b/PBot/MessageHistory_SQLite.pm index 47f6986d..ab2837d4 100644 --- a/PBot/MessageHistory_SQLite.pm +++ b/PBot/MessageHistory_SQLite.pm @@ -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/^([^!]+)!/; diff --git a/Plugins/Battleship.pm b/Plugins/Battleship.pm index f1b5fb46..3142fde7 100644 --- a/Plugins/Battleship.pm +++ b/Plugins/Battleship.pm @@ -743,7 +743,6 @@ sub bomb { } sub show_scoreboard { - my ($self) = @_; my $buf; diff --git a/Plugins/Spinach.pm b/Plugins/Spinach.pm index 55cf60ee..314117b5 100644 --- a/Plugins/Spinach.pm +++ b/Plugins/Spinach.pm @@ -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; diff --git a/Plugins/TypoSub.pm b/Plugins/TypoSub.pm index aff33c61..7476dd25 100644 --- a/Plugins/TypoSub.pm +++ b/Plugins/TypoSub.pm @@ -51,7 +51,6 @@ sub on_public { if ($msg =~ m/^\s*s${sep}(.*?)(?{pbot}->{messagehistory}->{database}->get_recent_messages_from_channel($channel, 50, $self->{pbot}->{messagehistory}->{MSG_CHAT}, 'DESC'); diff --git a/Plugins/UrlTitles.pm b/Plugins/UrlTitles.pm index 499c426a..fecdb790 100644 --- a/Plugins/UrlTitles.pm +++ b/Plugins/UrlTitles.pm @@ -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; diff --git a/Plugins/Weather.pm b/Plugins/Weather.pm index b43af870..f94f8ff9 100644 --- a/Plugins/Weather.pm +++ b/Plugins/Weather.pm @@ -61,7 +61,6 @@ sub weathercmd { } sub get_weather { - my ($self, $location) = @_; my %cache_opt = ( diff --git a/Plugins/Wttr.pm b/Plugins/Wttr.pm index 80929e0b..78e20cd0 100644 --- a/Plugins/Wttr.pm +++ b/Plugins/Wttr.pm @@ -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 = ( diff --git a/misc/update-version b/misc/update-version index 4d9a3040..551147ac 100755 --- a/misc/update-version +++ b/misc/update-version @@ -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",/;