Webqq/Plugin/Qiandao.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 44 CC 8 SCAR 41.6
CC
8
Cov
0%
call
72.0
BEGIN
2.0
CRAP 64.2
1 package Mojo::Webqq::Plugin::Qiandao;
2 use List::Util qw(first);
3 sub call {
4 my $client = shift;
5 my $data = shift;
6 my $callback = sub{
7 my @groups;
8 if(ref $data->{allow_group} eq "ARRAY"){
9 for my $g ($client->groups){
10 next if !first {$_=~/^\d+$/?$g->uid eq $_:$g->name eq $_} @{$data->{allow_group}};
11 push @groups,$g;
12 }
13 }
14 elsif(ref $data->{ban_group} eq "ARRAY"){
15 for my $g ($client->groups){
16 next if first {$_=~/^\d+$/?$g->uid eq $_:$g->name eq $_} @{$data->{ban_group}};
17 push @groups,$g;
18 }
19 }
20 else{
21 for($client->groups){push @groups,$_;}
22 }
23 for(@groups){$_->qiandao()}
24 };
25 $client->on(login=>$callback) if $data->{is_qiandao_on_login};
26 $client->add_job("Qiandao",$data->{qiandao_time} || "09:30",$callback);
27 }
28 1;