mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 04:22:35 +01:00
Tidy things up
This commit is contained in:
parent
c95fbd9ca0
commit
a6b2f60175
@ -584,7 +584,6 @@ sub unbanme {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (keys %$unbanned) {
|
if (keys %$unbanned) {
|
||||||
|
|
||||||
my $channels = '';
|
my $channels = '';
|
||||||
|
|
||||||
my $sep = '';
|
my $sep = '';
|
||||||
@ -596,7 +595,6 @@ sub unbanme {
|
|||||||
foreach my $channel (keys %$unbanned) {
|
foreach my $channel (keys %$unbanned) {
|
||||||
foreach my $mask (keys %{$unbanned->{$channel}}) {
|
foreach my $mask (keys %{$unbanned->{$channel}}) {
|
||||||
if ($self->{pbot}->{channels}->is_active_op("${channel}-floodbans")) {
|
if ($self->{pbot}->{channels}->is_active_op("${channel}-floodbans")) {
|
||||||
|
|
||||||
if ($unbanned->{$channel}->{$mask} <= 2) {
|
if ($unbanned->{$channel}->{$mask} <= 2) {
|
||||||
$self->{pbot}->{chanops}->unban_user($mask, $channel . '-floodbans');
|
$self->{pbot}->{chanops}->unban_user($mask, $channel . '-floodbans');
|
||||||
$channels .= "$sep$channel";
|
$channels .= "$sep$channel";
|
||||||
|
@ -55,7 +55,6 @@ sub get_banlist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub on_banlist_entry {
|
sub on_banlist_entry {
|
||||||
|
|
||||||
my ($self, $event_type, $event) = @_;
|
my ($self, $event_type, $event) = @_;
|
||||||
|
|
||||||
my $channel = lc $event->{event}->{args}[1];
|
my $channel = lc $event->{event}->{args}[1];
|
||||||
@ -91,7 +90,6 @@ sub on_banlist_entry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub on_quietlist_entry {
|
sub on_quietlist_entry {
|
||||||
|
|
||||||
my ($self, $event_type, $event) = @_;
|
my ($self, $event_type, $event) = @_;
|
||||||
|
|
||||||
my $channel = lc $event->{event}->{args}[1];
|
my $channel = lc $event->{event}->{args}[1];
|
||||||
|
@ -234,7 +234,6 @@ sub checkban {
|
|||||||
my $mask = $self->nick_to_banmask($target);
|
my $mask = $self->nick_to_banmask($target);
|
||||||
|
|
||||||
if ($self->{unban_timeout}->exists($channel, $mask)) {
|
if ($self->{unban_timeout}->exists($channel, $mask)) {
|
||||||
|
|
||||||
my $timeout = $self->{unban_timeout}->get_data($channel, $mask, 'timeout');
|
my $timeout = $self->{unban_timeout}->get_data($channel, $mask, 'timeout');
|
||||||
my $owner = $self->{unban_timeout}->get_data($channel, $mask, 'owner');
|
my $owner = $self->{unban_timeout}->get_data($channel, $mask, 'owner');
|
||||||
my $reason = $self->{unban_timeout}->get_data($channel, $mask, 'reason');
|
my $reason = $self->{unban_timeout}->get_data($channel, $mask, 'reason');
|
||||||
@ -288,7 +287,6 @@ sub checkmute {
|
|||||||
my $mask = $self->nick_to_banmask($target);
|
my $mask = $self->nick_to_banmask($target);
|
||||||
|
|
||||||
if ($self->{unmute_timeout}->exists($channel, $mask)) {
|
if ($self->{unmute_timeout}->exists($channel, $mask)) {
|
||||||
|
|
||||||
my $timeout = $self->{unmute_timeout}->get_data($channel, $mask, 'timeout');
|
my $timeout = $self->{unmute_timeout}->get_data($channel, $mask, 'timeout');
|
||||||
my $owner = $self->{unmute_timeout}->get_data($channel, $mask, 'owner');
|
my $owner = $self->{unmute_timeout}->get_data($channel, $mask, 'owner');
|
||||||
my $reason = $self->{unmute_timeout}->get_data($channel, $mask, 'reason');
|
my $reason = $self->{unmute_timeout}->get_data($channel, $mask, 'reason');
|
||||||
|
@ -301,7 +301,6 @@ sub list_undo_history {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub factundo {
|
sub factundo {
|
||||||
|
|
||||||
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
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)";
|
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 {
|
sub factredo {
|
||||||
|
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($from, $nick, $user, $host, $arguments) = @_;
|
my ($from, $nick, $user, $host, $arguments) = @_;
|
||||||
|
|
||||||
@ -916,7 +914,6 @@ sub factrem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub histogram {
|
sub histogram {
|
||||||
|
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($from, $nick, $user, $host, $arguments) = @_;
|
my ($from, $nick, $user, $host, $arguments) = @_;
|
||||||
my $factoids = $self->{pbot}->{factoids}->{factoids};
|
my $factoids = $self->{pbot}->{factoids}->{factoids};
|
||||||
@ -1160,7 +1157,6 @@ sub factinfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub top20 {
|
sub top20 {
|
||||||
|
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
my ($from, $nick, $user, $host, $arguments, $stuff) = @_;
|
my ($from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||||
@ -1228,7 +1224,6 @@ sub top20 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub count {
|
sub count {
|
||||||
|
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($from, $nick, $user, $host, $arguments) = @_;
|
my ($from, $nick, $user, $host, $arguments) = @_;
|
||||||
my $factoids = $self->{pbot}->{factoids}->{factoids};
|
my $factoids = $self->{pbot}->{factoids}->{factoids};
|
||||||
|
@ -371,7 +371,6 @@ sub expand_special_vars {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub expand_factoid_vars {
|
sub expand_factoid_vars {
|
||||||
|
|
||||||
my ($self, $stuff, @exclude) = @_;
|
my ($self, $stuff, @exclude) = @_;
|
||||||
|
|
||||||
my $from = length $stuff->{ref_from} ? $stuff->{ref_from} : $stuff->{from};
|
my $from = length $stuff->{ref_from} ? $stuff->{ref_from} : $stuff->{from};
|
||||||
@ -610,7 +609,6 @@ sub expand_action_arguments {
|
|||||||
|
|
||||||
if ($@) { next; }
|
if ($@) { next; }
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (not defined $value) {
|
if (not defined $value) {
|
||||||
if ($arg == 0) { $action =~ s/\$\{arg\[$arg\]\}/$nick/ || $action =~ s/\$arg\[$arg\]/$nick/; }
|
if ($arg == 0) { $action =~ s/\$\{arg\[$arg\]\}/$nick/ || $action =~ s/\$arg\[$arg\]/$nick/; }
|
||||||
else { $action =~ s/\s*\$\{arg\[$arg\]\}// || $action =~ s/\s*\$arg\[$arg\]//; }
|
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 no match found, attempt to call factoid from another channel if it exists there
|
||||||
if (not defined $keyword) {
|
if (not defined $keyword) {
|
||||||
|
|
||||||
my $string = "$original_keyword $stuff->{arguments}";
|
my $string = "$original_keyword $stuff->{arguments}";
|
||||||
|
|
||||||
my $lc_keyword = lc $original_keyword;
|
my $lc_keyword = lc $original_keyword;
|
||||||
|
@ -133,7 +133,6 @@ sub on_self_part {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub on_public {
|
sub on_public {
|
||||||
|
|
||||||
my ($self, $event_type, $event) = @_;
|
my ($self, $event_type, $event) = @_;
|
||||||
|
|
||||||
my $from = $event->{event}->{to}[0];
|
my $from = $event->{event}->{to}[0];
|
||||||
@ -149,7 +148,6 @@ sub on_public {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub on_msg {
|
sub on_msg {
|
||||||
|
|
||||||
my ($self, $event_type, $event) = @_;
|
my ($self, $event_type, $event) = @_;
|
||||||
my ($nick, $host) = ($event->{event}->nick, $event->{event}->host);
|
my ($nick, $host) = ($event->{event}->nick, $event->{event}->host);
|
||||||
my $text = $event->{event}->{args}[0];
|
my $text = $event->{event}->{args}[0];
|
||||||
|
@ -913,13 +913,6 @@ sub output_result {
|
|||||||
$pbot->{conn}->privmsg($stuff->{from}, $line) if defined $stuff->{from} && $stuff->{from} ne $botnick;
|
$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};
|
$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) {
|
} 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->{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};
|
$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) {
|
} elsif ($line =~ s/^\/msg\s+([^\s]+)\s+//i) {
|
||||||
@ -929,13 +922,6 @@ sub output_result {
|
|||||||
} elsif ($to =~ /.*serv(?:@.*)?$/i) {
|
} elsif ($to =~ /.*serv(?:@.*)?$/i) {
|
||||||
$pbot->{logger}->log("[HACK] Possible HACK ATTEMPT /msg *serv: [$stuff->{nick}!$stuff->{user}\@$stuff->{host}] [$stuff->{command}] [$line]\n");
|
$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) {
|
} 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->{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};
|
$pbot->{antiflood}->check_flood($to, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'pbot', '/me ' . $line, 0, 0, 0) if $stuff->{checkflood};
|
||||||
} else {
|
} else {
|
||||||
|
@ -684,9 +684,7 @@ sub get_message_account {
|
|||||||
|
|
||||||
if (defined $rows->[0] and not defined $orig_nick) {
|
if (defined $rows->[0] and not defined $orig_nick) {
|
||||||
if ($link_type == $self->{alias_type}->{STRONG}) {
|
if ($link_type == $self->{alias_type}->{STRONG}) {
|
||||||
|
|
||||||
my $host1 = lc "$nick!$user\@$host";
|
my $host1 = lc "$nick!$user\@$host";
|
||||||
|
|
||||||
my $host2 = lc $rows->[0]->{hostmask};
|
my $host2 = lc $rows->[0]->{hostmask};
|
||||||
my ($nick1) = $host1 =~ m/^([^!]+)!/;
|
my ($nick1) = $host1 =~ m/^([^!]+)!/;
|
||||||
my ($nick2) = $host2 =~ m/^([^!]+)!/;
|
my ($nick2) = $host2 =~ m/^([^!]+)!/;
|
||||||
|
@ -743,7 +743,6 @@ sub bomb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub show_scoreboard {
|
sub show_scoreboard {
|
||||||
|
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $buf;
|
my $buf;
|
||||||
|
@ -1427,7 +1427,6 @@ sub normalize_text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub validate_lie {
|
sub validate_lie {
|
||||||
|
|
||||||
my ($self, $truth, $lie) = @_;
|
my ($self, $truth, $lie) = @_;
|
||||||
|
|
||||||
my %truth_words = @{stem map { $_ => 1 } grep { /^\w+$/ and not exists $self->{stopwords}{lc $_} } split /\b/, $truth};
|
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) {
|
if (@liars) {
|
||||||
|
|
||||||
my $liars_text = '';
|
my $liars_text = '';
|
||||||
my $liars_no_apostrophe = '';
|
my $liars_no_apostrophe = '';
|
||||||
my $lie = $player->{truth};
|
my $lie = $player->{truth};
|
||||||
@ -1972,7 +1970,6 @@ sub showtruth {
|
|||||||
my ($self, $state) = @_;
|
my ($self, $state) = @_;
|
||||||
|
|
||||||
if ($state->{ticks} % 3 == 0) {
|
if ($state->{ticks} % 3 == 0) {
|
||||||
|
|
||||||
my $player_id;
|
my $player_id;
|
||||||
my $player_data;
|
my $player_data;
|
||||||
my $players;
|
my $players;
|
||||||
@ -2069,7 +2066,6 @@ sub showfinalscore {
|
|||||||
my ($self, $state) = @_;
|
my ($self, $state) = @_;
|
||||||
|
|
||||||
if ($state->{newstate}) {
|
if ($state->{newstate}) {
|
||||||
|
|
||||||
my $player_id;
|
my $player_id;
|
||||||
|
|
||||||
my $player_data;
|
my $player_data;
|
||||||
|
@ -51,7 +51,6 @@ sub on_public {
|
|||||||
if ($msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*?)(?<!\\)${sep}([g]*).*$/ or $msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*)$/) {
|
if ($msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*?)(?<!\\)${sep}([g]*).*$/ or $msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*)$/) {
|
||||||
my ($regex, $replacement, $modifiers) = ($1, $2, $3);
|
my ($regex, $replacement, $modifiers) = ($1, $2, $3);
|
||||||
eval {
|
eval {
|
||||||
|
|
||||||
my $rx = qr/$regex/;
|
my $rx = qr/$regex/;
|
||||||
|
|
||||||
my $messages = $self->{pbot}->{messagehistory}->{database}->get_recent_messages_from_channel($channel, 50, $self->{pbot}->{messagehistory}->{MSG_CHAT}, 'DESC');
|
my $messages = $self->{pbot}->{messagehistory}->{database}->get_recent_messages_from_channel($channel, 50, $self->{pbot}->{messagehistory}->{MSG_CHAT}, 'DESC');
|
||||||
|
@ -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 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'))
|
and grep { $channel =~ /$_/i } $self->{pbot}->{registry}->get_value('general', 'show_url_titles_channels'))
|
||||||
{
|
{
|
||||||
|
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
while ($msg =~ s/(https?:\/\/[^\s]+)//i && ++$count <= 3) {
|
while ($msg =~ s/(https?:\/\/[^\s]+)//i && ++$count <= 3) {
|
||||||
my $url = $1;
|
my $url = $1;
|
||||||
|
@ -61,7 +61,6 @@ sub weathercmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub get_weather {
|
sub get_weather {
|
||||||
|
|
||||||
my ($self, $location) = @_;
|
my ($self, $location) = @_;
|
||||||
|
|
||||||
my %cache_opt = (
|
my %cache_opt = (
|
||||||
|
@ -35,7 +35,6 @@ sub unload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub wttrcmd {
|
sub wttrcmd {
|
||||||
|
|
||||||
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||||
|
|
||||||
my @wttr_options = (
|
my @wttr_options = (
|
||||||
@ -103,7 +102,6 @@ sub wttrcmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub get_wttr {
|
sub get_wttr {
|
||||||
|
|
||||||
my ($self, $location, %options) = @_;
|
my ($self, $location, %options) = @_;
|
||||||
|
|
||||||
my %cache_opt = (
|
my %cache_opt = (
|
||||||
|
4
misc/update-version
vendored
4
misc/update-version
vendored
@ -19,11 +19,11 @@ $rev++;
|
|||||||
|
|
||||||
print "New version: $rev $date\n";
|
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>;
|
my @lines = <$in>;
|
||||||
close $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) {
|
foreach my $text (@lines) {
|
||||||
$text =~ s/BUILD_NAME\s+=> ".*",/BUILD_NAME => "PBot",/;
|
$text =~ s/BUILD_NAME\s+=> ".*",/BUILD_NAME => "PBot",/;
|
||||||
|
Loading…
Reference in New Issue
Block a user