From 66f6d867e9670670b47c744560125f7b8037bc73 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 22 Apr 2020 16:46:09 -0700 Subject: [PATCH] Remove redundant _name metadata from JSON files --- PBot/AntiFlood.pm | 2 +- PBot/AntiSpam.pm | 6 +- PBot/Capabilities.pm | 2 +- PBot/Channels.pm | 4 +- PBot/Commands.pm | 6 +- PBot/DualIndexHashObject.pm | 91 +++++-- PBot/HashObject.pm | 39 ++- PBot/VERSION.pm | 4 +- data/ban-exemptions | 4 +- data/capabilities | 242 +++++------------- data/channels | 2 - data/commands | 111 -------- data/ignorelist | 4 +- data/last_update | 2 +- data/registry | 109 +------- data/spam_keywords | 4 +- data/unban_timeouts | 4 +- data/unmute_timeouts | 4 +- data/users | 4 +- updates/3509_strip_redundant_name_metadata.pl | 83 ++++++ 20 files changed, 251 insertions(+), 476 deletions(-) create mode 100755 updates/3509_strip_redundant_name_metadata.pl diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index 63961194..c94b6353 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -95,7 +95,7 @@ sub ban_exempt { my $text = "Ban-evasion exemptions:\n"; my $entries = 0; foreach my $channel ($self->{'ban-exemptions'}->get_keys) { - $text .= ' ' . $self->{'ban-exemptions'}->get_data($channel, '_name') . ":\n"; + $text .= ' ' . $self->{'ban-exemptions'}->get_key_name($channel) . ":\n"; foreach my $mask ($self->{'ban-exemptions'}->get_keys($channel)) { $text .= " $mask,\n"; $entries++; diff --git a/PBot/AntiSpam.pm b/PBot/AntiSpam.pm index 289135a2..e30f7d81 100644 --- a/PBot/AntiSpam.pm +++ b/PBot/AntiSpam.pm @@ -68,9 +68,9 @@ sub antispam_cmd { my $text = "Spam keywords:\n"; my $entries = 0; foreach my $namespace ($self->{keywords}->get_keys) { - $text .= ' ' . $self->{keywords}->get_data($namespace, '_name') . ":\n"; + $text .= ' ' . $self->{keywords}->get_key_name($namespace) . ":\n"; foreach my $keyword ($self->{keywords}->get_keys($namespace)) { - $text .= ' ' . $self->{keywords}->get_data($namespace, $keyword, '_name') . ",\n"; + $text .= ' ' . $self->{keywords}->get_key_name($namespace, $keyword) . ",\n"; $entries++; } } @@ -84,7 +84,7 @@ sub antispam_cmd { if (not $self->{keywords}->exists($namespace)) { return "There is no such namespace `$namespace`."; } if (not $self->{keywords}->exists($namespace, $keyword)) { - return "There is no such regex `$keyword` for namespace `" . $self->{keywords}->get_data($namespace, '_name') . '`.'; + return "There is no such regex `$keyword` for namespace `" . $self->{keywords}->get_key_name($namespace) . '`.'; } if (not defined $flag) { diff --git a/PBot/Capabilities.pm b/PBot/Capabilities.pm index 772e6caa..a8ae123d 100644 --- a/PBot/Capabilities.pm +++ b/PBot/Capabilities.pm @@ -165,7 +165,7 @@ sub capcmd { if (@matches) { $result .= '; ' if $matched; my $global = $matched ? 'global: ' : ''; - $result .= $users->get_data($channel, '_name') eq '.*' ? $global : $users->get_data($channel, '_name') . ': '; + $result .= $users->get_key_name($channel) eq '.*' ? $global : $users->get_key_name($channel) . ': '; $result .= join ', ', @matches; $matched = 1; } diff --git a/PBot/Channels.pm b/PBot/Channels.pm index d2d00ee6..e46cc24b 100644 --- a/PBot/Channels.pm +++ b/PBot/Channels.pm @@ -101,7 +101,7 @@ sub list { my ($self, $from, $nick, $user, $host, $arguments) = @_; my $result; foreach my $channel (sort $self->{channels}->get_keys) { - $result .= $self->{channels}->get_data($channel, '_name') . ': {'; + $result .= $self->{channels}->get_key_name($channel) . ': {'; my $comma = ' '; foreach my $key (sort $self->{channels}->get_keys($channel)) { $result .= "$comma$key => " . $self->{channels}->get_data($channel, $key); @@ -117,7 +117,7 @@ sub autojoin { return if $self->{pbot}->{joined_channels}; my $channels; foreach my $channel ($self->{channels}->get_keys) { - if ($self->{channels}->get_data($channel, 'enabled')) { $channels .= $self->{channels}->get_data($channel, '_name') . ','; } + if ($self->{channels}->get_data($channel, 'enabled')) { $channels .= $self->{channels}->get_key_name($channel) . ','; } } $self->{pbot}->{logger}->log("Joining channels: $channels\n"); $self->{pbot}->{chanops}->join_channel($channels); diff --git a/PBot/Commands.pm b/PBot/Commands.pm index 66b81a81..da2acae2 100644 --- a/PBot/Commands.pm +++ b/PBot/Commands.pm @@ -174,7 +174,7 @@ sub help { # check built-in commands first if ($self->exists($keyword)) { if ($self->{metadata}->exists($keyword)) { - my $name = $self->{metadata}->get_data($keyword, '_name'); + my $name = $self->{metadata}->get_key_name($keyword); my $requires_cap = $self->{metadata}->get_data($keyword, 'requires_cap'); my $help = $self->{metadata}->get_data($keyword, 'help'); my $result = "/say $name: "; @@ -216,8 +216,8 @@ sub help { ($channel, $trigger) = ($factoids[0]->[0], $factoids[0]->[1]); } - my $channel_name = $self->{pbot}->{factoids}->{factoids}->get_data($channel, '_name'); - my $trigger_name = $self->{pbot}->{factoids}->{factoids}->get_data($channel, $trigger, '_name'); + my $channel_name = $self->{pbot}->{factoids}->{factoids}->get_key_name($channel); + my $trigger_name = $self->{pbot}->{factoids}->{factoids}->get_key_name($channel, $trigger); $channel_name = 'global channel' if $channel_name eq '.*'; $trigger_name = "\"$trigger_name\"" if $trigger_name =~ / /; diff --git a/PBot/DualIndexHashObject.pm b/PBot/DualIndexHashObject.pm index 1ae96eae..9aeb3953 100644 --- a/PBot/DualIndexHashObject.pm +++ b/PBot/DualIndexHashObject.pm @@ -67,9 +67,10 @@ sub load { # and lowercase any non-lowercased entries foreach my $primary_index (keys %{$self->{hash}}) { if (not exists $self->{hash}->{$primary_index}->{_name}) { - if (lc $primary_index eq $primary_index) { $self->{hash}->{$primary_index}->{_name} = $primary_index; } - else { - if (exists $self->{hash}->{lc $primary_index}) { Carp::croak "Cannot update $self->{name} primary index $primary_index; duplicate object found"; } + if ($primary_index ne lc $primary_index) { + if (exists $self->{hash}->{lc $primary_index}) { + Carp::croak "Cannot update $self->{name} primary index $primary_index; duplicate object found"; + } my $data = delete $self->{hash}->{$primary_index}; $data->{_name} = $primary_index; @@ -78,11 +79,9 @@ sub load { } } - foreach my $secondary_index (keys %{$self->{hash}->{$primary_index}}) { - next if $secondary_index eq '_name'; + foreach my $secondary_index (grep { $_ ne '_name' } keys %{$self->{hash}->{$primary_index}}) { if (not exists $self->{hash}->{$primary_index}->{$secondary_index}->{_name}) { - if (lc $secondary_index eq $secondary_index) { $self->{hash}->{$primary_index}->{$secondary_index}->{_name} = $secondary_index; } - else { + if ($secondary_index ne lc $secondary_index) { if (exists $self->{hash}->{$primary_index}->{lc $secondary_index}) { Carp::croak "Cannot update $self->{name} $primary_index sub-object $secondary_index; duplicate object found"; } @@ -142,7 +141,7 @@ sub levenshtein_matches { my $length = (length $primary_index > length $index) ? length $primary_index : length $index; if ($distance_result / $length < $distance) { - my $name = $self->{hash}->{$index}->{_name}; + my $name = $self->get_key_name($index); if ($name =~ / /) { $result .= $comma . "\"$name\""; } else { $result .= $comma . $name; } $comma = ", "; @@ -156,7 +155,7 @@ sub levenshtein_matches { my $header = ""; foreach my $index1 (sort keys %{$self->{hash}}) { - $header = "[$self->{hash}->{$index1}->{_name}] "; + $header = "[" . $self->get_key_name($index1) . "] "; $header = '[global] ' if $header eq '[.*] '; if ($strictnamespace) { @@ -169,7 +168,7 @@ sub levenshtein_matches { my $length = (length $secondary_index > length $index2) ? length $secondary_index : length $index2; if ($distance_result / $length < $distance) { - my $name = $self->{hash}->{$index1}->{$index2}->{_name}; + my $name = $self->get_key_name($index1, $index2); $header = "" if $last_header eq $header; $last_header = $header; $comma = '; ' if $comma ne '' and $header ne ''; @@ -199,13 +198,13 @@ sub set { if (not exists $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}) { my $secondary_text = $secondary_index =~ / / ? "\"$secondary_index\"" : $secondary_index; - my $result = "$self->{name}: [$self->{hash}->{$lc_primary_index}->{_name}] $secondary_text not found; similiar matches: "; + my $result = "$self->{name}: [" . $self->get_key_name($lc_primary_index) . "] $secondary_text not found; similiar matches: "; $result .= $self->levenshtein_matches($primary_index, $secondary_index); return $result; } - my $name1 = $self->{hash}->{$lc_primary_index}->{_name}; - my $name2 = $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{_name}; + my $name1 = $self->get_key_name($lc_primary_index); + my $name2 = $self->get_key_name($lc_primary_index, $lc_secondary_index); $name1 = 'global' if $name1 eq '.*'; $name2 = "\"$name2\"" if $name2 =~ / /; @@ -242,7 +241,7 @@ sub unset { return $result; } - my $name1 = $self->{hash}->{$lc_primary_index}->{_name}; + my $name1 = $self->get_key_name($lc_primary_index); $name1 = 'global' if $name1 eq '.*'; if (not exists $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}) { @@ -251,7 +250,7 @@ sub unset { return $result; } - my $name2 = $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{_name}; + my $name2 = $self->get_key_name($lc_primary_index, $lc_secondary_index); $name2 = "\"$name2\"" if $name2 =~ / /; if (defined delete $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{$key}) { @@ -275,6 +274,32 @@ sub exists { return exists $self->{hash}->{$primary_index}->{$secondary_index}->{$data_index}; } +sub get_key_name { + my ($self, $primary_index, $secondary_index) = @_; + + my $lc_primary_index = lc $primary_index; + + return $lc_primary_index if not exists $self->{hash}->{$lc_primary_index}; + + if (not defined $secondary_index) { + if (exists $self->{hash}->{$lc_primary_index}->{_name}) { + return $self->{hash}->{$lc_primary_index}->{_name}; + } else { + return $lc_primary_index; + } + } + + my $lc_secondary_index = lc $secondary_index; + + return $lc_secondary_index if not exists $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}; + + if (exists $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{_name}) { + return $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{_name}; + } else { + return $lc_secondary_index; + } +} + sub get_keys { my ($self, $primary_index, $secondary_index) = @_; return grep { $_ ne '$metadata$' } keys %{$self->{hash}} if not defined $primary_index; @@ -310,15 +335,22 @@ sub add { my $lc_secondary_index = lc $secondary_index; if (not exists $self->{hash}->{$lc_primary_index}) { - $self->{hash}->{$lc_primary_index}->{_name} = $primary_index; # preserve case + # preserve case + if ($primary_index ne $lc_primary_index) { + $self->{hash}->{$lc_primary_index}->{_name} = $primary_index; + } + } + + if ($secondary_index ne $lc_secondary_index) { + # preserve case + $data->{_name} = $secondary_index; } - $data->{_name} = $secondary_index; # preserve case $self->{hash}->{$lc_primary_index}->{$lc_secondary_index} = $data; $self->save() unless $dont_save; - my $name1 = $self->{hash}->{$lc_primary_index}->{_name}; - my $name2 = $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{_name}; + my $name1 = $self->get_key_name($lc_primary_index); + my $name2 = $self->get_key_name($lc_primary_index, $lc_secondary_index); $name1 = 'global' if $name1 eq '.*'; $name2 = "\"$name2\"" if $name2 =~ / /; $self->{pbot}->{logger}->log("$self->{name}: [$name1]: $name2 added.\n") unless $dont_save or $quiet; @@ -339,7 +371,7 @@ sub remove { if (not defined $secondary_index) { my $data = delete $self->{hash}->{$lc_primary_index}; if (defined $data) { - my $name = $data->{_name}; + my $name = exists $data->{_name} ? $data->{_name} : $lc_primary_index; $name = 'global' if $name eq '.*'; $self->save unless $dont_save; return "$self->{name}: $name removed."; @@ -348,7 +380,7 @@ sub remove { } } - my $name1 = $self->{hash}->{$lc_primary_index}->{_name}; + my $name1 = $self->get_key_name($lc_primary_index); $name1 = 'global' if $name1 eq '.*'; if (not exists $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}) { @@ -360,11 +392,13 @@ sub remove { if (not defined $data_index) { my $data = delete $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}; if (defined $data) { - my $name2 = $data->{_name}; + my $name2 = exists $data->{_name} ? $data->{_name} : $lc_secondary_index; $name2 = "\"$name2\"" if $name2 =~ / /; - # remove primary group if no more secondaries (only key left should be the _name key) - if (keys %{$self->{hash}->{$lc_primary_index}} == 1) { delete $self->{hash}->{$lc_primary_index}; } + # remove primary group if no more secondaries + if (grep { $_ ne '_name' } keys %{$self->{hash}->{$lc_primary_index}} == 0) { + delete $self->{hash}->{$lc_primary_index}; + } $self->save unless $dont_save; return "$self->{name}: [$name1] $name2 removed."; @@ -373,9 +407,12 @@ sub remove { } } - my $name2 = $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{_name}; - if (defined delete $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{$data_index}) { return "$self->{name}: [$name1] $name2.$data_index removed."; } - else { return "$self->{name}: [$name1] $name2.$data_index does not exist."; } + my $name2 = $self->get_key_name($lc_primary_index, $lc_secondary_index); + if (defined delete $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{$data_index}) { + return "$self->{name}: [$name1] $name2.$data_index removed."; + } else { + return "$self->{name}: [$name1] $name2.$data_index does not exist."; + } } # for compatibility with DualIndexSQLiteObject diff --git a/PBot/HashObject.pm b/PBot/HashObject.pm index 0283eeea..9262c114 100644 --- a/PBot/HashObject.pm +++ b/PBot/HashObject.pm @@ -67,9 +67,10 @@ sub load { # and lowercase any non-lowercased entries foreach my $index (keys %{$self->{hash}}) { if (not exists $self->{hash}->{$index}->{_name}) { - if (lc $index eq $index) { $self->{hash}->{$index}->{_name} = $index; } - else { - if (exists $self->{hash}->{lc $index}) { Carp::croak "Cannot update $self->{name} object $index; duplicate object found"; } + if ($index ne lc $index) { + if (exists $self->{hash}->{lc $index}) { + Carp::croak "Cannot update $self->{name} object $index; duplicate object found"; + } my $data = delete $self->{hash}->{$index}; $data->{_name} = $index; @@ -140,10 +141,9 @@ sub set { } if (not defined $key) { - my $result = "[$self->{name}] $self->{hash}->{$lc_index}->{_name} keys: "; + my $result = "[$self->{name}] " . $self->get_key_name($lc_index) . " keys: "; my $comma = ''; - foreach my $k (sort keys %{$self->{hash}->{$lc_index}}) { - next if $k eq '_name'; + foreach my $k (sort grep { $_ ne '_name' } keys %{$self->{hash}->{$lc_index}}) { $result .= $comma . "$k => " . $self->{hash}->{$lc_index}->{$k}; $comma = "; "; } @@ -156,7 +156,7 @@ sub set { $self->{hash}->{$lc_index}->{$key} = $value; $self->save unless $dont_save; } - return "[$self->{name}] $self->{hash}->{$lc_index}->{_name}: $key " . (defined $value ? "set to $value" : "is not set."); + return "[$self->{name}] " . $self->get_key_name($lc_index) . ": $key " . (defined $value ? "set to $value" : "is not set."); } sub unset { @@ -171,9 +171,9 @@ sub unset { if (defined delete $self->{hash}->{$lc_index}->{$key}) { $self->save; - return "[$self->{name}] $self->{hash}->{$lc_index}->{_name}: $key unset."; + return "[$self->{name}] " . $self->get_key_name($lc_index) . ": $key unset."; } else { - return "[$self->{name}] $self->{hash}->{$lc_index}->{_name}: $key does not exist."; + return "[$self->{name}] " . $self->get_key_name($lc_index) . ": $key does not exist."; } } @@ -183,6 +183,13 @@ sub exists { return exists $self->{hash}->{lc $index}->{$data_index}; } +sub get_key_name { + my ($self, $index) = @_; + my $lc_index = lc $index; + return $lc_index if not exists $self->{hash}->{$lc_index}; + return exists $self->{hash}->{$lc_index}->{_name} ? $self->{hash}->{$lc_index}->{_name} : $lc_index; +} + sub get_keys { my ($self, $index) = @_; return grep { $_ ne '$metadata$' } keys %{$self->{hash}} if not defined $index; @@ -200,7 +207,12 @@ sub get_data { sub add { my ($self, $index, $data, $dont_save) = @_; my $lc_index = lc $index; - $data->{_name} = $index; # preserve case of index + + # preserve case of index + if ($index ne $lc_index) { + $data->{_name} = $index; + } + $self->{hash}->{$lc_index} = $data; $self->save unless $dont_save; return "$index added to $self->{name}."; @@ -220,16 +232,17 @@ sub remove { if (defined delete $self->{hash}->{$lc_index}->{$data_index}) { delete $self->{hash}->{$lc_index} if keys(%{$self->{hash}->{$lc_index}}) == 1; $self->save unless $dont_save; - return "$self->{hash}->{$lc_index}->{_name}.$data_index removed from $self->{name}"; + return $self->get_key_name($lc_index) . ".$data_index removed from $self->{name}"; } else { - return "$self->{name}: $self->{hash}->{$lc_index}->{_name}.$data_index does not exist."; + return "$self->{name}: " . $self->get_key_name($lc_index) . ".$data_index does not exist."; } } my $data = delete $self->{hash}->{$lc_index}; if (defined $data) { $self->save unless $dont_save; - return "$data->{_name} removed from $self->{name}."; + my $name = exists $data->{_name} ? $data->{_name} : $lc_index; + return "$name removed from $self->{name}."; } else { return "$self->{name}: $data_index does not exist."; } diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 27c0a50e..ed476a17 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -19,8 +19,8 @@ use LWP::UserAgent; # These are set automatically by the misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 3507, - BUILD_DATE => "2020-04-21", + BUILD_REVISION => 3509, + BUILD_DATE => "2020-04-22", }; sub initialize { diff --git a/data/ban-exemptions b/data/ban-exemptions index c7218f16..d91f2ff2 100644 --- a/data/ban-exemptions +++ b/data/ban-exemptions @@ -1,10 +1,8 @@ { "$metadata$" : { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 - }, - "_name" : "$metadata$" + } } } diff --git a/data/capabilities b/data/capabilities index 4e92ba6a..4c7cb2c7 100644 --- a/data/capabilities +++ b/data/capabilities @@ -1,10 +1,8 @@ { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 }, "admin" : { - "_name" : "admin", "can-actiontrigger" : 1, "can-akalink" : 1, "can-akaunlink" : 1, @@ -34,7 +32,6 @@ "chanop" : 1 }, "botowner" : { - "_name" : "botowner", "admin" : 1, "can-actiontrigger" : 1, "can-akalink" : 1, @@ -105,113 +102,47 @@ "chanop" : 1, "is-whitelisted" : 1 }, - "can-actiontrigger" : { - "_name" : "can-actiontrigger" - }, - "can-akalink" : { - "_name" : "can-akalink" - }, - "can-akaunlink" : { - "_name" : "can-akaunlink" - }, - "can-antispam" : { - "_name" : "can-antispam" - }, + "can-actiontrigger" : {}, + "can-akalink" : {}, + "can-akaunlink" : {}, + "can-antispam" : {}, "can-ban" : { - "_name" : "can-ban", "can-mode-b" : 1 }, - "can-ban-exempt" : { - "_name" : "can-ban-exempt" - }, - "can-blacklist" : { - "_name" : "can-blacklist" - }, - "can-chanadd" : { - "_name" : "can-chanadd" - }, - "can-chanlist" : { - "_name" : "can-chanlist" - }, - "can-chanrem" : { - "_name" : "can-chanrem" - }, - "can-chanset" : { - "_name" : "can-chanset" - }, - "can-chanunset" : { - "_name" : "can-chanunset" - }, - "can-clear-bans" : { - "_name" : "can-clear-bans" - }, - "can-clear-mutes" : { - "_name" : "can-clear-mutes" - }, - "can-cmdset" : { - "_name" : "can-cmdset" - }, - "can-cmdunset" : { - "_name" : "can-cmdunset" - }, - "can-countertrigger" : { - "_name" : "can-countertrigger" - }, + "can-ban-exempt" : {}, + "can-blacklist" : {}, + "can-chanadd" : {}, + "can-chanlist" : {}, + "can-chanrem" : {}, + "can-chanset" : {}, + "can-chanunset" : {}, + "can-clear-bans" : {}, + "can-clear-mutes" : {}, + "can-cmdset" : {}, + "can-cmdunset" : {}, + "can-countertrigger" : {}, "can-deop" : { - "_name" : "can-deop", "can-mode-o" : 1 }, "can-devoice" : { - "_name" : "can-devoice", "can-mode-v" : 1 }, - "can-die" : { - "_name" : "can-die" - }, - "can-dumpbans" : { - "_name" : "can-dumpbans" - }, - "can-eval" : { - "_name" : "can-eval" - }, - "can-eventqueue" : { - "_name" : "can-eventqueue" - }, - "can-export" : { - "_name" : "can-export" - }, - "can-group-capabilities" : { - "_name" : "can-group-capabilities" - }, - "can-ignore" : { - "_name" : "can-ignore" - }, - "can-in" : { - "_name" : "can-in" - }, - "can-invite" : { - "_name" : "can-invite" - }, - "can-join" : { - "_name" : "can-join" - }, - "can-kick" : { - "_name" : "can-kick" - }, - "can-kick-wildcard" : { - "_name" : "can-kick-wildcard" - }, - "can-kill" : { - "_name" : "can-kill" - }, - "can-load" : { - "_name" : "can-load" - }, - "can-mode" : { - "_name" : "can-mode" - }, + "can-die" : {}, + "can-dumpbans" : {}, + "can-eval" : {}, + "can-eventqueue" : {}, + "can-export" : {}, + "can-group-capabilities" : {}, + "can-ignore" : {}, + "can-in" : {}, + "can-invite" : {}, + "can-join" : {}, + "can-kick" : {}, + "can-kick-wildcard" : {}, + "can-kill" : {}, + "can-load" : {}, + "can-mode" : {}, "can-mode-any" : { - "_name" : "can-mode-any", "can-mode" : 1, "can-mode-A" : 1, "can-mode-B" : 1, @@ -266,110 +197,53 @@ "can-mode-y" : 1, "can-mode-z" : 1 }, - "can-modify-admins" : { - "_name" : "can-modify-admins" - }, - "can-modify-capabilities" : { - "_name" : "can-modify-capabilities" - }, + "can-modify-admins" : {}, + "can-modify-capabilities" : {}, "can-mute" : { - "_name" : "can-mute", "can-mode-q" : 1 }, "can-op" : { - "_name" : "can-op", "can-mode-o" : 1 }, - "can-op-wildcard" : { - "_name" : "can-op-wildcard" - }, - "can-part" : { - "_name" : "can-part" - }, - "can-plug" : { - "_name" : "can-plug" - }, - "can-rebuildaliases" : { - "_name" : "can-rebuildaliases" - }, - "can-refresh" : { - "_name" : "can-refresh" - }, - "can-regchange" : { - "_name" : "can-regchange" - }, - "can-regex" : { - "_name" : "can-regex" - }, - "can-regset" : { - "_name" : "can-regset" - }, - "can-regsetmeta" : { - "_name" : "can-regsetmeta" - }, - "can-regunset" : { - "_name" : "can-regunset" - }, - "can-regunsetmeta" : { - "_name" : "can-regunsetmeta" - }, - "can-reload" : { - "_name" : "can-reload" - }, - "can-replug" : { - "_name" : "can-replug" - }, - "can-sl" : { - "_name" : "can-sl" - }, + "can-op-wildcard" : {}, + "can-part" : {}, + "can-plug" : {}, + "can-rebuildaliases" : {}, + "can-refresh" : {}, + "can-regchange" : {}, + "can-regex" : {}, + "can-regset" : {}, + "can-regsetmeta" : {}, + "can-regunset" : {}, + "can-regunsetmeta" : {}, + "can-reload" : {}, + "can-replug" : {}, + "can-sl" : {}, "can-unban" : { - "_name" : "can-unban", "can-mode-b" : 1 }, - "can-ungroup-capabilities" : { - "_name" : "can-ungroup-capabilities" - }, - "can-unignore" : { - "_name" : "can-unignore" - }, - "can-unload" : { - "_name" : "can-unload" - }, + "can-ungroup-capabilities" : {}, + "can-unignore" : {}, + "can-unload" : {}, "can-unmute" : { - "_name" : "can-unmute", "can-mode-q" : 1 }, - "can-unplug" : { - "_name" : "can-unplug" - }, - "can-useradd" : { - "_name" : "can-useradd" - }, - "can-userdel" : { - "_name" : "can-userdel" - }, - "can-userset" : { - "_name" : "can-userset" - }, - "can-userunset" : { - "_name" : "can-userunset" - }, + "can-unplug" : {}, + "can-useradd" : {}, + "can-userdel" : {}, + "can-userset" : {}, + "can-userunset" : {}, "can-voice" : { - "_name" : "can-voice", "can-mode-v" : 1 }, - "can-voice-wildcard" : { - "_name" : "can-voice-wildcard" - }, + "can-voice-wildcard" : {}, "chanmod" : { - "_name" : "chanmod", "can-devoice" : 1, "can-mod" : 1, "can-voice" : 1, "can-voice-wildcard" : 1 }, "chanop" : { - "_name" : "chanop", "can-ban" : 1, "can-deop" : 1, "can-devoice" : 1, @@ -384,8 +258,6 @@ "can-voice" : 1, "is-whitelisted" : 1 }, - "is-whitelisted" : { - "_name" : "is-whitelisted" - } + "is-whitelisted" : {} } diff --git a/data/channels b/data/channels index f72ea396..fe4dd7c8 100644 --- a/data/channels +++ b/data/channels @@ -1,11 +1,9 @@ { "#pbot2" : { - "_name" : "#pbot2", "chanop" : "0", "enabled" : "1" }, "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 } } diff --git a/data/commands b/data/commands index ffe44138..3ffde62a 100644 --- a/data/commands +++ b/data/commands @@ -1,579 +1,468 @@ { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 }, "actiontrigger" : { - "_name" : "actiontrigger", "dont-replace-pronouns" : "1", "help" : "Adds a new actiontrigger to PBot. See https://github.com/pragma-/pbot/blob/master/doc/ActionTrigger.md", "requires_cap" : 1 }, "aka" : { - "_name" : "aka", "help" : "Lists known aliases for a given nick. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#aka", "requires_cap" : 0 }, "akalink" : { - "_name" : "akalink", "help" : "Manually link a known alias to a nick. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#akalink", "requires_cap" : 1 }, "akaunlink" : { - "_name" : "akaunlink", "help" : "Manually unlink a known alias from a nick. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#akaunlink", "requires_cap" : 1 }, "antispam" : { - "_name" : "antispam", "help" : "See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#antispam", "requires_cap" : 1 }, "ban" : { - "_name" : "ban", "dont-replace-pronouns" : "1", "help" : "Bans a user. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#banmute", "requires_cap" : 1 }, "ban-exempt" : { - "_name" : "ban-exempt", "help" : "Manages list of ban-masks that are exempted from ban-evasion detection.", "requires_cap" : 1 }, "battleship" : { - "_name" : "battleship", "help" : "The classic Battleship board game, modified for IRC. See https://github.com/pragma-/pbot/blob/master/doc/Battleship.md", "requires_cap" : 0 }, "blacklist" : { - "_name" : "blacklist", "help" : "Blacklists a hostmask from joining a channel. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#blacklist", "requires_cap" : 1 }, "cap" : { - "_name" : "cap", "help" : "", "requires_cap" : 0 }, "chanadd" : { - "_name" : "chanadd", "help" : "Permanently adds a channel to PBot's list of channels to auto-join and manage. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#chanadd", "requires_cap" : 1 }, "chanlist" : { - "_name" : "chanlist", "help" : "Lists all added channels and their metadata keys and values. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#chanlist", "requires_cap" : 1 }, "chanrem" : { - "_name" : "chanrem", "help" : "Removes a channel from PBot's list of channels to auto-join and manage. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#chanrem", "requires_cap" : 1 }, "chanset" : { - "_name" : "chanset", "help" : "Sets a channel's metadata. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#chanset and https://github.com/pragma-/pbot/blob/master/doc/Admin.md#channel-metadata-list", "requires_cap" : 1 }, "chanunset" : { - "_name" : "chanunset", "help" : "Deletes a channel's metadata key. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#chanunset", "requires_cap" : 1 }, "checkban" : { - "_name" : "checkban", "help" : "Shows the reason a mask was banned and how long the ban lasts. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#checkban", "requires_cap" : 0 }, "checkmute" : { - "_name" : "checkmute", "help" : "Shows the reason a mask was muted and how long the mute lasts. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#checkmute", "requires_cap" : 0 }, "cmdset" : { - "_name" : "cmdset", "dont-replace-pronouns" : "1", "help" : "Sets or shows command metadata. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#cmdset", "requires_cap" : 1 }, "cmdunset" : { - "_name" : "cmdunset", "help" : "Deletes a channel metadata key. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#cmdunset", "requires_cap" : 1 }, "connect4" : { - "_name" : "connect4", "help" : "The classic Connect-4 board game. See https://github.com/pragma-/pbot/blob/master/doc/Connect4.md", "requires_cap" : 0 }, "count" : { - "_name" : "count", "help" : "Shows how many factoids and what percentage of the database has submitted. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#count", "requires_cap" : 0 }, "counteradd" : { - "_name" : "counteradd", "help" : "Adds a new counter. See https://github.com/pragma-/pbot/blob/master/doc/Counter.md#add", "requires_cap" : 0 }, "counterdel" : { - "_name" : "counterdel", "help" : "Deletes a counter. See https://github.com/pragma-/pbot/blob/master/doc/Counter.md#del", "requires_cap" : 0 }, "counterlist" : { - "_name" : "counterlist", "help" : "Lists counters. See https://github.com/pragma-/pbot/blob/master/doc/Counter.md#list", "requires_cap" : 0 }, "counterreset" : { - "_name" : "counterreset", "help" : "Resets a counter. See https://github.com/pragma-/pbot/blob/master/doc/Counter.md#reset", "requires_cap" : 0 }, "countershow" : { - "_name" : "countershow", "help" : "Shows a counter's data. See https://github.com/pragma-/pbot/blob/master/doc/Counter.md#show", "requires_cap" : 0 }, "countertrigger" : { - "_name" : "countertrigger", "help" : "Manages counter triggers. See https://github.com/pragma-/pbot/blob/master/doc/Counter.md#trigger", "requires_cap" : 1 }, "date" : { - "_name" : "date", "help" : "Shows date and time for a timezone. Accepts Linux timezone locations. You can set `!my timezone ...` to remember your timezone.", "requires_cap" : 0 }, "delq" : { - "_name" : "delq", "help" : "Deletes a quote from the quotegrabs database. See https://github.com/pragma-/pbot/blob/master/doc/Quotegrabs.md#delq", "requires_cap" : 0 }, "deop" : { - "_name" : "deop", "help" : "Removes OP status from users. Accepts wildcards. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#deop", "requires_cap" : 1 }, "devoice" : { - "_name" : "devoice", "help" : "Removes VOICE status from users. Accepts wildcards. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#devoice", "requires_cap" : 1 }, "die" : { - "_name" : "die", "help" : "Tells PBot to disconnect and exit. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#die", "requires_cap" : 1 }, "dumpbans" : { - "_name" : "dumpbans", "help" : "Displays PBot's internal banlist data structure. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#dumpbans", "requires_cap" : 1 }, "eval" : { - "_name" : "eval", "dont-replace-pronouns" : "1", "help" : "Evaluates Perl code within PBot's context. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#eval", "requires_cap" : 1 }, "export" : { - "_name" : "export", "background-process" : "1", "help" : "Exports specified list to HTML file. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#export", "requires_cap" : 1 }, "fact" : { - "_name" : "fact", "help" : "Displays or invokes a factoid belonging to a specific channel. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#fact", "requires_cap" : 0 }, "factadd" : { - "_name" : "factadd", "dont-replace-pronouns" : "1", "help" : "Creates a new factoid. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factadd", "requires_cap" : 0 }, "factalias" : { - "_name" : "factalias", "help" : "Creates a factoid that acts as an alias for a command. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factalias", "requires_cap" : 0 }, "factchange" : { - "_name" : "factchange", "dont-replace-pronouns" : "1", "help" : "Changes a factoid using a regular expression. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factchange", "requires_cap" : 0 }, "factfind" : { - "_name" : "factfind", "dont-replace-pronouns" : "1", "help" : "Searches the database for a factoid. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factfind", "requires_cap" : 0 }, "factinfo" : { - "_name" : "factinfo", "help" : "Displays information about a factoid, such as who submitted it and when. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factinfo", "requires_cap" : 0 }, "factlog" : { - "_name" : "factlog", "help" : "Displays a factoid's changelog history. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factlog", "requires_cap" : 0 }, "factmove" : { - "_name" : "factmove", "help" : "Renames a factoid or moves a factoid to a different channel. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factmove", "requires_cap" : 0 }, "factredo" : { - "_name" : "factredo", "help" : "Reverts a factoid to a newer revision. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factredo", "requires_cap" : 0 }, "factrem" : { - "_name" : "factrem", "dont-replace-pronouns" : "1", "help" : "Deletes a factoid. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factrem", "requires_cap" : 0 }, "factset" : { - "_name" : "factset", "dont-replace-pronouns" : "1", "help" : "Displays or sets factoid metadata, such as owner, rate-limit, etc. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factset and https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factoid-metadata-list", "requires_cap" : 0 }, "factshow" : { - "_name" : "factshow", "dont-replace-pronouns" : "1", "help" : "Displays a factoid's literal value without invoking the factoid. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factshow", "requires_cap" : 0 }, "factundo" : { - "_name" : "factundo", "help" : "Reverts a factoid to an older revision. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factundo", "requires_cap" : 0 }, "factunset" : { - "_name" : "factunset", "help" : "Unsets a factoid metadata key. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factunset and https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factoid-metadata-list", "requires_cap" : 0 }, "forget" : { - "_name" : "forget", "dont-replace-pronouns" : "1", "help" : "Deletes a factoid. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#forget", "requires_cap" : 0 }, "func" : { - "_name" : "func", "help" : "Invokes built-in functions. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#func", "requires_cap" : 0 }, "getq" : { - "_name" : "getq", "help" : "Retrieves and displays a specific quote from the quotegrabs database. See https://github.com/pragma-/pbot/blob/master/doc/Quotegrabs.md#getq", "requires_cap" : 0 }, "google" : { - "_name" : "google", "dont-replace-pronouns" : "1", "help" : "Displays Google search results for a query. See https://github.com/pragma-/pbot/blob/master/doc/Modules.md#google", "requires_cap" : 0 }, "grab" : { - "_name" : "grab", "help" : "Grabs a message someone says, and adds it to the quotegrabs database. See https://github.com/pragma-/pbot/blob/master/doc/Quotegrabs.md#grab", "requires_cap" : 0 }, "help" : { - "_name" : "help", "dont-replace-pronouns" : "1", "help" : "Displays the `help` metadata for commands and factoids.", "requires_cap" : 0 }, "histogram" : { - "_name" : "histogram", "help" : "Displays a histogram of the top factoid submitters. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#histogram", "requires_cap" : 0 }, "ignore" : { - "_name" : "ignore", "help" : "Ignores a user. If you omit [channel] PBot will ignore the user in all channels, including private messages. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#ignore", "requires_cap" : 1 }, "in" : { - "_name" : "in", "help" : "Performs a command in a specific channel. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#in", "requires_cap" : 1 }, "invite" : { - "_name" : "invite", "help" : "Invites a user to a channel. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#invite", "requires_cap" : 1 }, "join" : { - "_name" : "join", "help" : "Temporarily joins a channel without adding it to PBot's list of channels to manage/auto-join. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#join", "requires_cap" : 1 }, "kick" : { - "_name" : "kick", "help" : "Removes a user from the channel. Accepts wildcards. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#kick", "requires_cap" : 1 }, "lagcheck" : { - "_name" : "lagcheck", "help" : "Displays history of PING times. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#lagcheck", "requires_cap" : 0 }, "learn" : { - "_name" : "learn", "help" : "Creates a new factoid. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#factadd", "requires_cap" : 0 }, "list" : { - "_name" : "list", "help" : "Lists various collections, such as channels or admins. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#list" }, "load" : { - "_name" : "load", "help" : "This command loads a module as a PBot command. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#load", "requires_cap" : 1 }, "login" : { - "_name" : "login", "help" : "Logs into a PBot admin account. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#login", "requires_cap" : 0 }, "logout" : { - "_name" : "logout", "help" : "Logs out of a PBot admin account. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#logout", "requires_cap" : 0 }, "mod" : { - "_name" : "mod", "help" : "Provides restricted moderation abilities to voiced users. They can kick/ban/etc only users that are not admins, whitelisted, voiced or opped.", "requires_cap" : 0 }, "mode" : { - "_name" : "mode", "help" : "Sets or unsets channel or user modes. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#mode", "requires_cap" : 1 }, "mute" : { - "_name" : "mute", "dont-replace-pronouns" : "1", "help" : "Mutes a user. Accepts wildcards. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#banmute", "requires_cap" : 1 }, "my" : { - "_name" : "my", "dont-replace-pronouns" : "1", "help" : "Lets users view and manipulate their own user metadata. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#my and https://github.com/pragma-/pbot/blob/master/doc/Admin.md#user-metadata-list", "requires_cap" : "0" }, "nicklist" : { - "_name" : "nicklist", "help" : "Dumps the internal nicklist structure. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#nicklist", "requires_cap" : 0 }, "op" : { - "_name" : "op", "help" : "Gives channel operator status to users. Accepts wildcards. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#op", "requires_cap" : "1" }, "part" : { - "_name" : "part", "help" : "Departs a channel, without removing it from PBot's list of channels to manage/auto-join. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#part", "requires_cap" : 1 }, "plug" : { - "_name" : "plug", "help" : "Loads a plugin into PBot. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#plug", "requires_cap" : 1 }, "pluglist" : { - "_name" : "pluglist", "help" : "Lists all currently loaded plugins. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#pluglist", "requires_cap" : 0 }, "rebuildaliases" : { - "_name" : "rebuildaliases", "help" : "Rebuilds the aka link table. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#rebuildaliases", "requires_cap" : 1 }, "recall" : { - "_name" : "recall", "background-process" : "1", "help" : "Recalls previous chat history for a channel. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#recall", "requires_cap" : 0 }, "refresh" : { - "_name" : "refresh", "help" : "Refreshes and reloads PBot core modules and plugins. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#refresh", "requires_cap" : 0 }, "regchange" : { - "_name" : "regchange", "help" : "Changes the value of a registry item using a regular expression. See https://github.com/pragma-/pbot/blob/master/doc/Registry.md#regchange", "requires_cap" : 1 }, "regex" : { - "_name" : "regex", "help" : "Manages regular expression commands. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#regex", "requires_cap" : 1 }, "regfind" : { - "_name" : "regfind", "help" : "Searches the registry for keywords or values. See https://github.com/pragma-/pbot/blob/master/doc/Registry.md#regfind", "requires_cap" : 0 }, "regset" : { - "_name" : "regset", "help" : "Creates a new registry item or updates an existing item. See https://github.com/pragma-/pbot/blob/master/doc/Registry.md#regset", "requires_cap" : 1 }, "regsetmeta" : { - "_name" : "regsetmeta", "help" : "Sets or displays the metadata for a specific registry key. See https://github.com/pragma-/pbot/blob/master/doc/Registry.md#regsetmeta and https://github.com/pragma-/pbot/blob/master/doc/Registry.md#metadata-list", "requires_cap" : 1 }, "regshow" : { - "_name" : "regshow", "help" : "Displays the type and value of a registry item. See https://github.com/pragma-/pbot/blob/master/doc/Registry.md#regshow", "requires_cap" : 0 }, "regunset" : { - "_name" : "regunset", "help" : "Deletes a registry item from a specific section/channel. See https://github.com/pragma-/pbot/blob/master/doc/Registry.md#regunset", "requires_cap" : 1 }, "regunsetmeta" : { - "_name" : "regunsetmeta", "help" : "Deletes a metadata key from a registry item. See https://github.com/pragma-/pbot/blob/master/doc/Registry.md#regsetmeta and https://github.com/pragma-/pbot/blob/master/doc/Registry.md#metadata", "requires_cap" : 1 }, "reload" : { - "_name" : "reload", "help" : "Reloads a data or configuration file. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#reload", "requires_cap" : 1 }, "remindme" : { - "_name" : "remindme", "help" : "Manages user reminders. See https://github.com/pragma-/pbot/blob/master/doc/Remindme.md", "requires_cap" : 0 }, "replug" : { - "_name" : "replug", "help" : "Reloads a plugin into PBot. The plugin is first unloaded and then it is loaded again. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#replug", "requires_cap" : 1 }, "rq" : { - "_name" : "rq", "help" : "Retrieves and displays a random quote from the quotegrabs database. See https://github.com/pragma-/pbot/blob/master/doc/Quotegrabs.md#rq", "requires_cap" : 0 }, "sl" : { - "_name" : "sl", "help" : "Sends a raw IRC command to the server. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#sl", "requires_cap" : 1 }, "spinach" : { - "_name" : "spinach", "dont-replace-pronouns" : "1", "help" : "Manages and interacts with the Spinach trivia game. See https://github.com/pragma-/pbot/blob/master/doc/Spinach.md", "requires_cap" : 0 }, "top20" : { - "_name" : "top20", "help" : "Displays the top 20 most popular factoids. See https://github.com/pragma-/pbot/blob/master/doc/Factoids.md#top20", "requires_cap" : 0 }, "unban" : { - "_name" : "unban", "dont-replace-pronouns" : "1", "help" : "Unbans a user. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#unbanunmute", "requires_cap" : 1 }, "unbanme" : { - "_name" : "unbanme", "help" : "Removes a join-flood ban. See https://github.com/pragma-/pbot/blob/master/doc/Abuse.md#unbanme", "requires_cap" : 0 }, "unignore" : { - "_name" : "unignore", "help" : "Unignores a user. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#unignore", "requires_cap" : 1 }, "unload" : { - "_name" : "unload", "help" : "Unloads a module and removes its associated command. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#unload", "requires_cap" : 1 }, "unmute" : { - "_name" : "unmute", "dont-replace-pronouns" : "1", "help" : "Unmutes a user. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#unbanunmute", "requires_cap" : 1 }, "unplug" : { - "_name" : "unplug", "help" : "Unloads a plugin from PBot. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#unplug", "requires_cap" : 1 }, "uptime" : { - "_name" : "uptime", "help" : "Displays the date and time this instance of PBot was started and how long it has been running.", "requires_cap" : 0 }, "useradd" : { - "_name" : "useradd", "dont-replace-pronouns" : "1", "help" : "Adds a new user to PBot. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#useradd", "requires_cap" : 1 }, "userdel" : { - "_name" : "userdel", "dont-replace-pronouns" : "1", "help" : "Removes an user from PBot. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#userdel", "requires_cap" : 1 }, "users" : { - "_name" : "users", "help" : "", "requires_cap" : 0 }, "userset" : { - "_name" : "userset", "dont-replace-pronouns" : "1", "help" : "Sets metadata for an user account. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#userset and https://github.com/pragma-/pbot/blob/master/doc/Admin.md#user-metadata-list", "requires_cap" : 1 }, "userunset" : { - "_name" : "userunset", "dont-replace-pronouns" : "1", "help" : "Deletes a metadata key from an user account. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#userunset", "requires_cap" : 1 }, "version" : { - "_name" : "version", "help" : "", "requires_cap" : 0 }, "voice" : { - "_name" : "voice", "help" : "Sets mode +v on users. Accepts wildcards. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#voice", "requires_cap" : 1 }, "weather" : { - "_name" : "weather", "background-process" : "1", "help" : "Fetches and displays weather data. You may set `!my location ...` to remember your location.", "requires_cap" : 0 }, "wttr" : { - "_name" : "wttr", "background-process" : "1", "help" : "", "requires_cap" : "0" diff --git a/data/ignorelist b/data/ignorelist index c7218f16..d91f2ff2 100644 --- a/data/ignorelist +++ b/data/ignorelist @@ -1,10 +1,8 @@ { "$metadata$" : { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 - }, - "_name" : "$metadata$" + } } } diff --git a/data/last_update b/data/last_update index 0960009b..0d4336f8 100644 --- a/data/last_update +++ b/data/last_update @@ -1 +1 @@ -3507 +3509 diff --git a/data/registry b/data/registry index cb48902d..d184d699 100644 --- a/data/registry +++ b/data/registry @@ -1,189 +1,148 @@ { "$metadata$" : { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 - }, - "_name" : "$metadata$" + } }, "antiaway" : { - "_name" : "antiaway", "bad_actions" : { - "_name" : "bad_actions", "type" : "text", "value" : "^/me (is (away|gone)|.*auto.?away)" }, "bad_nicks" : { - "_name" : "bad_nicks", "type" : "text", "value" : "(^z+[[:punct:]]|[[:punct:]](afk|brb|bbl|away|sleep|asleep|nap|z+|work|gone|study|out|home|busy|off)[[:punct:]]*$|afk$)" }, "kick_msg" : { - "_name" : "kick_msg", "type" : "text", "value" : "http://sackheads.org/~bnaylor/spew/away_msgs.html" } }, "antiflood" : { - "_name" : "antiflood", "antirepeat" : { - "_name" : "antirepeat", "type" : "text", "value" : "1" }, "antirepeat_allow_bot" : { - "_name" : "antirepeat_allow_bot", "type" : "text", "value" : "1" }, "antirepeat_match" : { - "_name" : "antirepeat_match", "type" : "text", "value" : "0.5" }, "antirepeat_threshold" : { - "_name" : "antirepeat_threshold", "type" : "text", "value" : "2.5" }, "chat_flood_punishment" : { - "_name" : "chat_flood_punishment", "type" : "array", "value" : "60,300,3600,86400,604800,2419200" }, "chat_flood_threshold" : { - "_name" : "chat_flood_threshold", "type" : "text", "value" : "4" }, "chat_flood_time_threshold" : { - "_name" : "chat_flood_time_threshold", "type" : "text", "value" : "5" }, "debug_checkban" : { - "_name" : "debug_checkban", "type" : "text", "value" : "0" }, "dont_enforce_admins" : { - "_name" : "dont_enforce_admins", "type" : "text", "value" : "1" }, "enforce" : { - "_name" : "enforce", "type" : "text", "value" : "1" }, "enter_abuse_max_offenses" : { - "_name" : "enter_abuse_max_offenses", "type" : "text", "value" : "3" }, "enter_abuse_punishment" : { - "_name" : "enter_abuse_punishment", "type" : "array", "value" : "60,300,3600,86400,604800,2419200" }, "enter_abuse_threshold" : { - "_name" : "enter_abuse_threshold", "type" : "text", "value" : "4" }, "enter_abuse_time_threshold" : { - "_name" : "enter_abuse_time_threshold", "type" : "text", "value" : "15" }, "join_flood_punishment" : { - "_name" : "join_flood_punishment", "type" : "array", "value" : "115200,3600,10800,604800" }, "join_flood_threshold" : { - "_name" : "join_flood_threshold", "type" : "text", "value" : "4" }, "join_flood_time_threshold" : { - "_name" : "join_flood_time_threshold", "type" : "text", "value" : "1800" }, "nick_flood_punishment" : { - "_name" : "nick_flood_punishment", "type" : "array", "value" : "1800,3600,86400,604800" }, "nick_flood_threshold" : { - "_name" : "nick_flood_threshold", "type" : "text", "value" : "3" }, "nick_flood_time_threshold" : { - "_name" : "nick_flood_time_threshold", "type" : "text", "value" : "1800" } }, "antikickautorejoin" : { - "_name" : "antikickautorejoin", "punishment" : { - "_name" : "punishment", "type" : "array", "value" : "300,900,1800,3600,28800" }, "threshold" : { - "_name" : "threshold", "type" : "text", "value" : "4" } }, "antispam" : { - "_name" : "antispam", "enforce" : { - "_name" : "enforce", "type" : "text", "value" : "1" } }, "autorejoin" : { - "_name" : "autorejoin", "rejoin_delay" : { - "_name" : "rejoin_delay", "type" : "array", "value" : "900,1800,3600" } }, "bantracker" : { - "_name" : "bantracker", "chanserv_ban_timeout" : { - "_name" : "chanserv_ban_timeout", "type" : "text", "value" : "604800" }, "debug" : { - "_name" : "debug", "type" : "text", "value" : "0" }, "mute_timeout" : { - "_name" : "mute_timeout", "type" : "text", "value" : "604800" } }, "date" : { - "_name" : "date", "default_timezone" : { - "_name" : "default_timezone", "type" : "text", "value" : "UTC" } }, "dualindexsqliteobject" : { - "_name" : "dualindexsqliteobject", "debug_factoids" : { "_name" : "debug_Factoids", "type" : "text", @@ -191,306 +150,242 @@ } }, "factoids" : { - "_name" : "factoids", "default_rate_limit" : { - "_name" : "default_rate_limit", "type" : "text", "value" : "15" }, "max_channel_length" : { - "_name" : "max_channel_length", "type" : "text", "value" : "20" }, "max_content_length" : { - "_name" : "max_content_length", "type" : "text", "value" : "8192" }, "max_name_length" : { - "_name" : "max_name_length", "type" : "text", "value" : "100" } }, "general" : { - "_name" : "general", "autojoin_wait_for_nickserv" : { - "_name" : "autojoin_wait_for_nickserv", "type" : "text", "value" : "0" }, "compile_blocks" : { - "_name" : "compile_blocks", "type" : "text", "value" : "1" }, "compile_blocks_channels" : { - "_name" : "compile_blocks_channels", "type" : "array", "value" : ".*" }, "compile_blocks_ignore_channels" : { - "_name" : "compile_blocks_ignore_channels", "type" : "array", "value" : "none" }, "data_dir" : { - "_name" : "data_dir", "type" : "text", "value" : "data" }, "debugcontext" : { - "_name" : "debugcontext", "type" : "text", "value" : "0" }, "deop_timeout" : { - "_name" : "deop_timeout", "type" : "text", "value" : "300" }, "identify_command" : { - "_name" : "identify_command", "type" : "text", "value" : "identify $nick $password" }, "identify_nick" : { - "_name" : "identify_nick", "type" : "text", "value" : "nickserv" }, "module_dir" : { - "_name" : "module_dir", "type" : "text", "value" : "./modules" }, "module_repo" : { - "_name" : "module_repo", "type" : "text", "value" : "https://github.com/pragma-/pbot/blob/master/modules/" }, "module_timeout" : { - "_name" : "module_timeout", "type" : "text", "value" : "30" }, "op_command" : { - "_name" : "op_command", "type" : "text", "value" : "op $channel" }, "op_nick" : { - "_name" : "op_nick", "type" : "text", "value" : "chanserv" }, "plugin_dir" : { - "_name" : "plugin_dir", "type" : "text", "value" : "./Plugins" }, "show_url_titles" : { - "_name" : "show_url_titles", "type" : "text", "value" : "1" }, "show_url_titles_channels" : { - "_name" : "show_url_titles_channels", "type" : "array", "value" : ".*" }, "show_url_titles_ignore_channels" : { - "_name" : "show_url_titles_ignore_channels", "type" : "array", "value" : "none" }, "strictnamespace" : { - "_name" : "strictnamespace", "type" : "text", "value" : "1" }, "trigger" : { - "_name" : "trigger", "type" : "text", "value" : "[!]" } }, "googlesearch" : { - "_name" : "googlesearch", "api_key" : { - "_name" : "api_key", "private" : "1", "type" : "text", "value" : "" }, "context" : { - "_name" : "context", "private" : "1", "type" : "text", "value" : "" } }, "interpreter" : { - "_name" : "interpreter", "max_recursion" : { - "_name" : "max_recursion", "type" : "text", "value" : "100" } }, "irc" : { - "_name" : "irc", "botnick" : { - "_name" : "botnick", "type" : "text", - "value" : "" + "value" : "wtfsadfff" }, "debug" : { - "_name" : "debug", "type" : "text", "value" : "0" }, "identify_password" : { - "_name" : "identify_password", "private" : "1", "type" : "text", "value" : "" }, "log_default_handler" : { - "_name" : "log_default_handler", "type" : "text", "value" : "1" }, "max_msg_len" : { - "_name" : "max_msg_len", "type" : "text", "value" : "425" }, "port" : { - "_name" : "port", "type" : "text", "value" : "6667" }, "randomize_nick" : { - "_name" : "randomize_nick", "type" : "text", "value" : "0" }, "realname" : { - "_name" : "realname", "type" : "text", "value" : "https://github.com/pragma-/pbot" }, "server" : { - "_name" : "server", "type" : "text", "value" : "irc.freenode.net" }, "show_motd" : { - "_name" : "show_motd", "type" : "text", "value" : "1" }, "ssl" : { - "_name" : "ssl", "type" : "text", "value" : "0" }, "ssl_ca_file" : { - "_name" : "ssl_ca_file", "private" : "1", "type" : "text", "value" : "none" }, "ssl_ca_path" : { - "_name" : "ssl_ca_path", "private" : "1", "type" : "text", "value" : "none" }, "username" : { - "_name" : "username", "type" : "text", "value" : "pbot3" } }, "lagchecker" : { - "_name" : "lagchecker", "lag_history_interval" : { - "_name" : "lag_history_interval", "type" : "text", "value" : "10" }, "lag_history_max" : { - "_name" : "lag_history_max", "type" : "text", "value" : "3" }, "lag_threshold" : { - "_name" : "lag_threshold", "type" : "text", "value" : "2000" } }, "messagehistory" : { - "_name" : "messagehistory", "debug_aka" : { - "_name" : "debug_aka", "type" : "text", "value" : "0" }, "debug_link" : { - "_name" : "debug_link", "type" : "text", "value" : "0" }, "max_messages" : { - "_name" : "max_messages", "type" : "text", "value" : "32" }, "max_recall_time" : { - "_name" : "max_recall_time", "type" : "text", "value" : "0" }, "sqlite_commit_interval" : { - "_name" : "sqlite_commit_interval", "type" : "text", "value" : "5" }, "sqlite_debug" : { - "_name" : "sqlite_debug", "type" : "text", "value" : "0" } }, "nicklist" : { - "_name" : "nicklist", "debug" : { - "_name" : "debug", "type" : "text", "value" : "0" } }, "plugins" : { - "_name" : "plugins", "disabled" : { - "_name" : "disabled", "type" : "text", "value" : "0" }, "noautoload" : { - "_name" : "noautoload", "type" : "text", "value" : "0" } }, "spinach" : { - "_name" : "spinach", "file" : { - "_name" : "file", "type" : "text", "value" : "jeopardy_complete.json" } diff --git a/data/spam_keywords b/data/spam_keywords index c7218f16..d91f2ff2 100644 --- a/data/spam_keywords +++ b/data/spam_keywords @@ -1,10 +1,8 @@ { "$metadata$" : { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 - }, - "_name" : "$metadata$" + } } } diff --git a/data/unban_timeouts b/data/unban_timeouts index c7218f16..d91f2ff2 100644 --- a/data/unban_timeouts +++ b/data/unban_timeouts @@ -1,10 +1,8 @@ { "$metadata$" : { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 - }, - "_name" : "$metadata$" + } } } diff --git a/data/unmute_timeouts b/data/unmute_timeouts index c7218f16..d91f2ff2 100644 --- a/data/unmute_timeouts +++ b/data/unmute_timeouts @@ -1,10 +1,8 @@ { "$metadata$" : { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 - }, - "_name" : "$metadata$" + } } } diff --git a/data/users b/data/users index c7218f16..d91f2ff2 100644 --- a/data/users +++ b/data/users @@ -1,10 +1,8 @@ { "$metadata$" : { "$metadata$" : { - "_name" : "$metadata$", "update_version" : 3503 - }, - "_name" : "$metadata$" + } } } diff --git a/updates/3509_strip_redundant_name_metadata.pl b/updates/3509_strip_redundant_name_metadata.pl new file mode 100755 index 00000000..420a15b3 --- /dev/null +++ b/updates/3509_strip_redundant_name_metadata.pl @@ -0,0 +1,83 @@ +#!/usr/bin/env perl + +# Strips redundant _name metadata from HashObject and DualIndexHashObject JSON files + +use warnings; use strict; + +BEGIN { + use File::Basename; + my $location = -l __FILE__ ? dirname readlink __FILE__ : dirname __FILE__; + unshift @INC, $location; +} + +use lib3503::HashObject; +use lib3503::DualIndexHashObject; +use lib3503::PBot; + +my ($data_dir, $version, $last_update) = @ARGV; + +print "Stripping redundant _name metadata... version: $version, last_update: $last_update, data_dir: $data_dir\n"; + +my @hashobjects = qw/channels commands capabilities/; +my @dualindex = qw/unban_timeouts unmute_timeouts ban-exemptions ignorelist registry spam_keywords users/; + +my $pbot = lib3503::PBot->new(); + +foreach my $hashobject (@hashobjects) { + print "Updating $data_dir/$hashobject ...\n"; + my $obj = lib3503::HashObject->new(name => $hashobject, filename => "$data_dir/$hashobject", pbot => $pbot); + $obj->load; + + foreach my $index (keys %{$obj->{hash}}) { + if ($index eq lc $index) { + if (exists $obj->{hash}->{$index}->{_name}) { + if ($obj->{hash}->{$index}->{_name} eq lc $obj->{hash}->{$index}->{_name}) { + delete $obj->{hash}->{$index}->{_name}; + } + } + } else { + print "error: $index expected to be all-lowercased; cannot continue\n"; + exit 1; + } + } + + $obj->save; +} + +foreach my $hashobject (@dualindex) { + print "Updating $data_dir/$hashobject ...\n"; + my $obj = lib3503::DualIndexHashObject->new(name => $hashobject, filename => "$data_dir/$hashobject", pbot => $pbot); + $obj->load; + + foreach my $index1 (keys %{$obj->{hash}}) { + if ($index1 ne lc $index1) { + print "error: primary index $index1 expected to be all-lowercased; cannot continue\n"; + exit 1; + } + + if (exists $obj->{hash}->{$index1}->{_name}) { + if ($obj->{hash}->{$index1}->{_name} eq lc $obj->{hash}->{$index1}->{_name}) { + delete $obj->{hash}->{$index1}->{_name}; + } + } + + foreach my $index2 (keys %{$obj->{hash}->{$index1}}) { + next if $index2 eq '_name'; + + if ($index2 ne lc $index2) { + print "error: $index1.$index2 expected to be all-lowercased; cannot continue\n"; + exit 1; + } + + if (exists $obj->{hash}->{$index1}->{$index2}->{_name}) { + if ($obj->{hash}->{$index1}->{$index2}->{_name} eq lc $obj->{hash}->{$index1}->{$index2}->{_name}) { + delete $obj->{hash}->{$index1}->{$index2}->{_name}; + } + } + } + } + + $obj->save; +} + +exit 0;