vk/system/API/Methods/Message.php

47 lines
1005 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace VK\API\Methods;
use \VK\Core;
use \VK\API\Traits\Request;
use \VK\Robots\RobotAbstract;
class Message
{
use Request;
private const METHOD = 'messages.send';
public static function post($from, int $to, string $message, int $trolling)
{
if (is_int($from)) {
// Если получен идентификатор, а не экземпляр RobotAbstract
// Поиск в регистре
$from = Core::init()->get($from);
}
// Параметры
$params = [
'message' => $message,
'peer_id' => $to,
'access_token' => $from->token,
'v' => $from->version,
'random_id' => $trolling
];
// Запрос
self::request(self::METHOD, $params, $from->getBrowser());
}
public static function get()
{
}
public static function delete()
{
}
}