diff options
| author | 2013-10-23 17:40:15 +0000 | |
|---|---|---|
| committer | 2013-10-23 17:40:15 +0000 | |
| commit | bbb625fbd7ee5ebb2e3e2564b3c7117f08200e7d (patch) | |
| tree | 8ab67260025801c3d6fec83b30b61e8ae8332337 /modules/command.pl | |
| parent | 5239387031d9426a2001187789d4ae6a87dbd966 (diff) | |
all sorts of stuff changed. This is just one big code package update
Diffstat (limited to 'modules/command.pl')
| -rw-r--r-- | modules/command.pl | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/modules/command.pl b/modules/command.pl index 7576850..014e89b 100644 --- a/modules/command.pl +++ b/modules/command.pl @@ -27,18 +27,29 @@ sub command # return 0 unless (ASM::Util->speak($event->{to}->[0])); foreach my $command ( @{$::commands->{command}} ) { - unless (ASM::Util->speak($event->{to}->[0])) { + my $fail = 0; + unless ( (ASM::Util->speak($event->{to}->[0])) or (!ASM::Util->notRestricted($nick, "nocommands")) ) { next unless (defined($command->{nohush}) && ($command->{nohush} eq "nohush")); } if (defined($command->{flag})) { #If the command is restricted, - next unless defined($::users->{person}->{$acct}); #make sure the requester has an account - next unless defined($::users->{person}->{$acct}->{flags}); #make sure the requester has flags defined - next unless (grep {$_ eq $command->{flag}} split('', $::users->{person}->{$acct}->{flags})); #make sure the requester has the needed flags + if (!defined($::users->{person}->{$acct})) { #make sure the requester has an account + $fail = 1; + } + elsif (!defined($::users->{person}->{$acct}->{flags})) { #make sure the requester has flags defined + $fail = 1; + } + elsif (!(grep {$_ eq $command->{flag}} split('', $::users->{person}->{$acct}->{flags}))) { #make sure the requester has the needed flags + $fail = 1; + } } if ($cmd=~/$command->{cmd}/) { ASM::Util->dprint("$event->{from} told me: $cmd", "commander"); - eval $command->{content}; - warn $@ if $@; + if ($fail == 1) { + $conn->privmsg($nick, "You don't have permission to use that command, or you're not signed into nickserv."); + } else { + eval $command->{content}; + warn $@ if $@; + } last; } } |
