From 20695d5f73e173508d61cf997949ab256b9167b9 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 11 Feb 2020 21:59:39 -0800 Subject: [PATCH] Plugins/Spinach: replace levels with capabilities --- Plugins/Spinach.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Plugins/Spinach.pm b/Plugins/Spinach.pm index fa3ee1a8..2054c77a 100644 --- a/Plugins/Spinach.pm +++ b/Plugins/Spinach.pm @@ -388,9 +388,9 @@ sub spinach_cmd { } when ('load') { - my $admin = $self->{pbot}->{users}->loggedin_admin($self->{channel}, "$nick!$user\@$host"); - if (not $admin or $admin->{level} < 90) { - return "$nick: Sorry, only very powerful admins may reload the questions."; + my $u = $self->{pbot}->{users}->loggedin($self->{channel}, "$nick!$user\@$host"); + if (not $u or not $self->{pbot}->{capabilities}->userhas($u, 'botowner')) { + return "$nick: Sorry, only botowners may reload the questions."; } $arguments = undef if not length $arguments; @@ -922,9 +922,9 @@ sub spinach_cmd { return "Usage: spinach state set "; } - my $admin = $self->{pbot}->{users}->loggedin_admin($self->{channel}, "$nick!$user\@$host"); - if (not $admin or $admin->{level} < 90) { - return "$nick: Sorry, only very powerful admins may set game state."; + my $u = $self->{pbot}->{users}->loggedin($self->{channel}, "$nick!$user\@$host"); + if (not $self->{pbot}->{capabilities}->userhas($u, 'admin')) { + return "$nick: Sorry, only admins may set game state."; } $self->{previous_state} = $self->{current_state}; @@ -938,8 +938,8 @@ sub spinach_cmd { } my $admin = $self->{pbot}->{users}->loggedin_admin($self->{channel}, "$nick!$user\@$host"); - if (not $admin or $admin->{level} < 90) { - return "$nick: Sorry, only very powerful admins may set game state."; + if (not $admin) { + return "$nick: Sorry, only admins may set game state."; } $self->{state_data}->{previous_result} = $self->{state_data}->{result}; @@ -962,7 +962,7 @@ sub spinach_cmd { } my $admin = $self->{pbot}->{users}->loggedin_admin($self->{channel}, "$nick!$user\@$host"); - if (defined $value and (not $admin or $admin->{level} <= 0)) { + if (defined $value and not $admin) { return "$nick: Sorry, only Spinach admins may set game settings."; } @@ -981,7 +981,7 @@ sub spinach_cmd { } my $admin = $self->{pbot}->{users}->loggedin_admin($self->{channel}, "$nick!$user\@$host"); - if (not $admin or $admin->{level} <= 0) { + if (not $admin) { return "$nick: Sorry, only Spinach admins may set game settings."; }