Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
/ vk-to-telegram Public archive

Autoposting of entries from the VK group to the Telegram channel

License

Notifications You must be signed in to change notification settings

aidsoul/vk-to-telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b11adf5 · Mar 31, 2022

History

6 Commits
Mar 30, 2022
Feb 6, 2022
Mar 31, 2022
Feb 6, 2022
Feb 6, 2022

Repository files navigation

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.

About

Autoposting of entries from the VK group to the Telegram channel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages