PHP code example of vbot / blacklist

1. Go to this page and download the library: Download vbot/blacklist library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vbot / blacklist example snippets


name: blacklist
zhName: 黑名单
author: HanSon

// ...
'extension' => [
    // 管理员配置(必选),优先加载 remark_name
    'admin' => [
        'remark'   => '',
        'nickname' => 'vbot',
    ],
    'blacklist' => [
        'type' => [
            'text', 'emoticon'
        ],
        'warn' => function ($message) {
            $nickname = $message['fromType'] == 'Group' ? $message['sender']['NickName'] : $message['from']['NickName'];
            \Hanson\Vbot\Message\Text::send($message['from']['UserName'], "@{$nickname} 警告!你的消息频率略高!");
        },
        'block' => function ($message) {
            $nickname = $message['fromType'] == 'Group' ? $message['sender']['NickName'] : $message['from']['NickName'];
            \Hanson\Vbot\Message\Text::send($message['from']['UserName'], "@{$nickname} 你已被永久拉黑!");
        },
    ]
],