aidsoul/botpvt

此包已被废弃,不再维护。未建议替代包。

1.1.2 2022-03-30 09:58 UTC

This package is auto-updated.

Last update: 2023-09-29 02:47:15 UTC


README

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f616964736f756c2f766b2d746f2d74656c656772616d

在此处提供新版本:https://github.com/aidsoul/vktote

安装

要安装,使用以下命令:git clone https://github.com/aidsoul/vk-to-telegram

使用以下命令下载必要的库:composer install

或者使用命令:composer require aidsoul/botpvt

连接示例

require_once __DIR__.'/vendor/autoload.php';
$config =  [
    'Vk'        =>[
   	    'token'         => 'Your token',
   	    'idGroup'       => 'Group id or name',
   	    'count'         => 5
    ],
    'Telegram'  =>[
      	'botApiKey'     => '',
      	'botName'       => '',
     	  'chatId'        =>  0
    ],
    'Db'        =>[
       	'host'          => 'mysql:host=localhost',
       	'dbName'        =>  'vk',
        'user'          =>  'root',
        'pass'          =>  ''
      ],
  ];

Botpvt\Start::vk($config);

小部件

require_once __DIR__.'/vendor/autoload.php';
use Botpvt\Config\Config;
// Combining all widgets into text and pinning in the channel
/**/
Config::set($config);
$con = new Botpvt\Widgets\Conclusion;
$con->push();

如果您需要发送特定的小部件,请使用

$widget = Botpvt\Widgets\ExchangeRate;
// get a string with the answer
$str = $widget->get();

此方法不会向电报频道发送数据!

MySQL

项目使用mysql数据库。

最后,导入数据库文件:db.sql

任务调度器

使用服务器上的crontab或另一个任务调度器来获取新帖子而不停止。

使用示例

打开并添加任务到任务列表:crontab-e。每分钟获取新条目:* * * * * php /path for php file