aidsoul/botpvt

This package is abandoned and no longer maintained. No replacement package was suggested.

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

New versions available here: https://github.com/aidsoul/vktote

Installation

To install, use the command: git clone https://github.com/aidsoul/vk-to-telegram.

Download the necessary libraries using the command: composer install.

Or use command composer require aidsoul/botpvt.

Connection example

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);

Widgets

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();

If you need to send only a specific widget, use:

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

This method does not send data to the telegram channel!

MySQL

The project uses a mysql database.

And finally, import the database file: db.sql.

Task Scheduler

Use crontab on your server or another task scheduler to get fresh posts without stopping.

Usage example

Open and add a task to the task list: crontab-e. Get fresh entries every minute: * * * * * php /patch for php file.