Skip to content

Commit

Permalink
IRCShell插件增加is_ban_official参数,用于控制是否接收公众号消息
Browse files Browse the repository at this point in the history
  • Loading branch information
hexsum committed Sep 20, 2018
1 parent ff117dd commit cec1815
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/Weixin.pod
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ Mojo::Weixin - A Weixin Client Framework base on Mojolicious
upload_api #图床api地址,将图片转为连接,方便在irc上查看图片
#支持兼容 http://img.vim-cn.com/ 的接口,考虑到隐私问题,默认不开启
media_dir #sendFile指令发送文件的默认目录,默认值与 new 中的 media_dir 参数相同
is_ban_official #是否接收公众号消息,默认0,表示接收

#以下参数需要 Mojo::IRC::Server::Chinese v1.8.1及以上版本

Expand Down
1 change: 1 addition & 0 deletions lib/Mojo/Weixin.pod
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ Mojo::Weixin - A Weixin Client Framework base on Mojolicious
upload_api #图床api地址,将图片转为连接,方便在irc上查看图片
#支持兼容 http://img.vim-cn.com/ 的接口,考虑到隐私问题,默认不开启
media_dir #sendFile指令发送文件的默认目录,默认值与 new 中的 media_dir 参数相同
is_ban_official #是否接收公众号消息,默认0,表示接收

#以下参数需要 Mojo::IRC::Server::Chinese v1.8.1及以上版本

Expand Down
1 change: 1 addition & 0 deletions lib/Mojo/Weixin/Plugin/IRCShell.pm
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ sub call{
$client->on(receive_message=>sub{
my($client,$msg) = @_;
if($msg->type eq "friend_message"){
return if $data->{is_ban_official} and $msg->sender->category eq '公众号';
my $friend = $msg->sender;
my $user = $ircd->search_user(id=>$friend->id,virtual=>1) || $ircd->search_user(nick=>$friend->displayname,virtual=>0);
my $channel = $ircd->search_channel(name=>'#我的好友') || $ircd->new_channel(name=>'#我的好友',mode=>"Pivs");
Expand Down

0 comments on commit cec1815

Please sign in to comment.