diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index ecb4a7e9..cee99163 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -79,6 +79,7 @@ sub initialize { $self->{pbot}->{commands}->register(sub { return $self->unbanme(@_) }, "unbanme", 0); $self->{pbot}->{commands}->register(sub { return $self->whitelist(@_) }, "whitelist", 1); + $self->{pbot}->{capabilities}->add('admin', 'can-whitelist', 1); $self->{pbot}->{event_dispatcher}->register_handler('irc.whoisaccount', sub { $self->on_whoisaccount(@_) }); $self->{pbot}->{event_dispatcher}->register_handler('irc.whoisuser', sub { $self->on_whoisuser(@_) }); diff --git a/PBot/AntiSpam.pm b/PBot/AntiSpam.pm index befecbe6..970cf484 100644 --- a/PBot/AntiSpam.pm +++ b/PBot/AntiSpam.pm @@ -42,6 +42,7 @@ sub initialize { $self->{pbot}->{registry}->add_default('text', 'antispam', 'enforce', $conf{enforce_antispam} // 1); $self->{pbot}->{commands}->register(sub { return $self->antispam_cmd(@_) }, "antispam", 1); + $self->{pbot}->{capabilities}->add('admin', 'can-antispam', 1); } sub is_spam { diff --git a/PBot/BlackList.pm b/PBot/BlackList.pm index bcdffb56..a9f39855 100644 --- a/PBot/BlackList.pm +++ b/PBot/BlackList.pm @@ -34,6 +34,7 @@ sub initialize { $self->{filename} = $conf{filename}; $self->{blacklist} = {}; $self->{pbot}->{commands}->register(sub { $self->blacklist(@_) }, "blacklist", 1); + $self->{pbot}->{capabilities}->add('admin', 'can-blacklist', 1); $self->load_blacklist; } diff --git a/PBot/Capabilities.pm b/PBot/Capabilities.pm index 9d70a9dd..f668e0b2 100644 --- a/PBot/Capabilities.pm +++ b/PBot/Capabilities.pm @@ -41,14 +41,14 @@ sub initialize { $self->add('can-group-capabilities', undef, 1); $self->add('can-ungroup-capabilities', undef, 1); - # add admin capabilities group - $self->add('admin', 'chanop', 1); # add chanop capabilities group -- see ChanOpCommands.md + # add capabilites to admin capabilities group + $self->add('admin', 'chanop', 1); # add chanop capabilities group to admin group -- see ChanOpCommands.md $self->add('admin', 'can-useradd', 1); $self->add('admin', 'can-userdel', 1); $self->add('admin', 'can-userset', 1); $self->add('admin', 'can-userunset', 1); - $self->add('admin', 'can-join', 1); - $self->add('admin', 'can-part', 1); + $self->add('admin', 'can-mode', 1); + $self->add('admin', 'can-mode-any', 1); } sub has { @@ -254,7 +254,7 @@ sub capcmd { my $u = $self->{pbot}->{users}->loggedin($from, "$nick!$user\@$host"); return "You must be logged into your user account to remove capabilities from groups." if not defined $u; - return "You must have the can-remove-capabilities capability to remove capabilities from groups." if not $self->userhas($u, 'can-ungroup-capabilities'); + return "You must have the can-ungroup-capabilities capability to remove capabilities from groups." if not $self->userhas($u, 'can-ungroup-capabilities'); return "Capability $subcap does not belong to the $cap capability group." if not $self->has($cap, $subcap); $self->remove($cap, $subcap); diff --git a/PBot/Channels.pm b/PBot/Channels.pm index ed0c05ef..b87b1364 100644 --- a/PBot/Channels.pm +++ b/PBot/Channels.pm @@ -39,6 +39,10 @@ sub initialize { $self->{pbot}->{commands}->register(sub { $self->add(@_) }, "chanadd", 1); $self->{pbot}->{commands}->register(sub { $self->remove(@_) }, "chanrem", 1); $self->{pbot}->{commands}->register(sub { $self->list(@_) }, "chanlist", 1); + + $self->{pbot}->{capabilities}->add('admin', 'can-join', 1); + $self->{pbot}->{capabilities}->add('admin', 'can-part', 1); + $self->{pbot}->{capabilities}->add('admin', 'can-chanlist', 1); } sub join { diff --git a/PBot/Commands.pm b/PBot/Commands.pm index afabf061..4c30486d 100644 --- a/PBot/Commands.pm +++ b/PBot/Commands.pm @@ -43,6 +43,8 @@ sub initialize { $self->register(sub { $self->help(@_) }, "help", 0); $self->register(sub { $self->uptime(@_) }, "uptime", 0); $self->register(sub { $self->in_channel(@_) }, "in", 1); + + $self->{pbot}->{capabilities}->add('admin', 'in', 1); } sub register { diff --git a/PBot/IgnoreListCommands.pm b/PBot/IgnoreListCommands.pm index 8aa0bba9..718834ee 100644 --- a/PBot/IgnoreListCommands.pm +++ b/PBot/IgnoreListCommands.pm @@ -31,6 +31,8 @@ sub initialize { $self->{pbot} = $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__); $self->{pbot}->{commands}->register(sub { $self->ignore_user(@_) }, "ignore", 1); $self->{pbot}->{commands}->register(sub { $self->unignore_user(@_) }, "unignore", 1); + $self->{pbot}->{capabilities}->add('admin', 'can-ignore', 1); + $self->{pbot}->{capabilities}->add('admin', 'can-unignore', 1); } sub ignore_user { diff --git a/PBot/MessageHistory.pm b/PBot/MessageHistory.pm index f164b018..a9c11c73 100644 --- a/PBot/MessageHistory.pm +++ b/PBot/MessageHistory.pm @@ -56,6 +56,9 @@ sub initialize { $self->{pbot}->{commands}->register(sub { $self->aka_link(@_) }, "akalink", 1); $self->{pbot}->{commands}->register(sub { $self->aka_unlink(@_) }, "akaunlink", 1); + $self->{pbot}->{capabilities}->add('admin', 'can-akalink', 1); + $self->{pbot}->{capabilities}->add('admin', 'can-akaunlink', 1); + $self->{pbot}->{atexit}->register(sub { $self->{database}->end(); return; }); }