Началр работы с переработкой
This commit is contained in:
94
sources/Robots/Group.php
Normal file
94
sources/Robots/Group.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace VK\Robots;
|
||||
|
||||
use VK\Browsers\BrowserAbstract;
|
||||
use VK\Parsers\Curl;
|
||||
use Exception;
|
||||
use VK\API\LongPoll;
|
||||
|
||||
/**
|
||||
* Робот: "Группа"
|
||||
*
|
||||
* Класс реализовывающий работу от лица группы ВКонтакте
|
||||
*
|
||||
* @package Robots
|
||||
* @author Arsen Mirzaev
|
||||
*/
|
||||
class Group extends RobotAbstract
|
||||
{
|
||||
/**
|
||||
* ВКонтакте: идентификатор
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public int $id;
|
||||
|
||||
/**
|
||||
* ВКонтакте: токен доступа
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public string $token;
|
||||
|
||||
/**
|
||||
* ВКонтакте: версия API
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
public float $version;
|
||||
|
||||
/**
|
||||
* ВКонтакте: тип API
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public string $api;
|
||||
|
||||
/**
|
||||
* ВКонтакте: активатор мобильной версии
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
//protected bool $mobile = false;
|
||||
|
||||
/**
|
||||
* ВКонтакте: идентификатор капчи
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
//protected int $captcha;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
if (!isset($this->id)) $this->id = (int) $_ENV['DEFAULT_' . strtoupper($name) . '_ID'];
|
||||
if (!isset($this->token)) $this->token = (string) $_ENV['DEFAULT_' . strtoupper($name) . '_TOKEN'];
|
||||
if (!isset($this->version)) $this->version = (float) $_ENV['DEFAULT_API_VERSION'];
|
||||
}
|
||||
|
||||
public function postMethod($method, $params = []): BrowserAbstract
|
||||
{
|
||||
$browser = __NAMESPACE__ . '\\Browsers\\' . ucfirst($_ENV['BROWSER_TYPE']);
|
||||
return (new $browser)->post();
|
||||
}
|
||||
|
||||
public function longpoll(...$params): LongPoll
|
||||
{
|
||||
return new LongPoll($this, $params);
|
||||
}
|
||||
|
||||
public function callback()
|
||||
{
|
||||
}
|
||||
|
||||
protected function genToken(): string
|
||||
{
|
||||
return 'test';
|
||||
}
|
||||
protected function genTokenMobile(string $captcha_key, int $captcha_id): string
|
||||
{
|
||||
return 'test 2';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user