Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议给推送增加“公众号白名单”功能 #170

Open
sylingd opened this issue Aug 20, 2018 · 1 comment
Open

建议给推送增加“公众号白名单”功能 #170

sylingd opened this issue Aug 20, 2018 · 1 comment

Comments

@sylingd
Copy link

sylingd commented Aug 20, 2018

目前代码里面,如果开启了is_ban_official,则所有公众号消息都不会触发推送

if($msg->type eq 'friend_message'){
    return if $data->{is_ban_official} and $msg->sender->category eq '公众号';
    $msgId = $msg->sender->id;
    $title = $msg->sender->displayname;
    $message = $msg->content;
    $senderType = '1';
}

但是另外几种消息均有不同的判定方式,如:

elsif($msg->type eq 'discuss_message'){
    return if ref $data->{ban_discuss}  eq "ARRAY" and @{$data->{ban_discuss}} and first {$_=~/^\d+$/?$msg->discuss->uid eq $_:$msg->discuss->displayname eq $_} @{$data->{ban_discuss}};
    return if ref $data->{allow_discuss}  eq "ARRAY" and @{$data->{allow_discuss}} and !first {$_=~/^\d+$/?$msg->discuss->uid eq $_:$msg->discuss->displayname eq $_} @{$data->{allow_discuss}};
    $msgId= $msg->discuss->id;
    $title = $msg->discuss->displayname;
    $message = $msg->sender->displayname . ": " . $msg->content;
    $senderType = '3';
}

能否考虑将公众号也改为类似的方式?用于不接收大部分公众号消息推送,只接收某些特定公众号的消息推送(如各类消息通知、某些比较优质的公众号)

@hexsum
Copy link
Owner

hexsum commented Sep 30, 2018

@sylingd 你已经把相关代码都贴出来了 如果动手能力强 建议自己直接改下代码更容易满足自己各种定制化需求,也欢迎提交PR~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants