Webqq/Plugin/FuckDaShen.pm untested

filter: Statementstmt 0.0% 0 / 13 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 21 CC 4 SCAR 30.0
CC
4
Cov
0%
call
20.0
CRAP 20.0
1 package Mojo::Webqq::Plugin::FuckDaShen;
2 $Mojo::Webqq::Plugin::FuckDaShen::PRIORITY = 1;
3  
4 my @reply = (
5 "动不动就叫%...",
6 "%能不能换点别的称呼...",
7 "%,%,%,%..喜欢你就叫个够...",
8 "请问%是指哪位?",
9 "能不能别随随便便就叫%?"
10 );
11 sub call {
12 my $client = shift;
13 $client->on(receive_message=>sub{
14 my($client,$msg)=@_;
15 return if not $msg->allow_plugin;
16 return if $msg->content !~ /(大\s*神|大\s*婶|大\s*侠)/;
17 my $key_word = $1;$key_word=~s/\s+//;
18 my $reply = $reply[int rand($#reply+1)];
19 $reply=~s/%/$key_word/g;
20 $client->reply_message($msg,$reply,sub{$_[1]->from("bot")}) if $reply;
21 });
22 }
23 1;