| 1 | package Mojo::Weixin::Plugin::FuckDaShen; | ||
| 2 | $Mojo::Weixin::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; |