I found protected function post($endpoint, array $params = [], $fileUpload = false) in source code.
But I think converting it to public function is more useful.
I appreciate it in advance
Edit:
I found another public method to call it for custom methods.
public function __call($method, $arguments)
It solved my problem!
@khalilst I don't understand how did you solve it! Please explain me (I need to use deleteMessage).
Yes the __call method in the class Telegram\Bot\Api is public, but it processes only actions with the get prefix?!:
public function __call($method, $arguments)
{
$action = substr($method, 0, 3);
if ($action === 'get') {
/* @noinspection PhpUndefinedFunctionInspection */
$class_name = studly_case(substr($method, 3));
$class = 'Telegram\Bot\Objects\\'.$class_name;
$response = $this->post($method, $arguments[0] ?: []);
if (class_exists($class)) {
return new $class($response->getDecodedBody());
}
return $response;
}
return false;
}
@zvermafia
__call has two arguments. The first one method name and deleteMessage in your case.
The second is an array of array containing method params. chat_id and message_id in your case.
So you could call __call for your deleteMessage like this:
Telegram::__call('deleteMessage', [['chat_id' => $yourChatId, 'message_id' => $yourMessageId]])
Consider the datatype of second argument as Array of Array (^_^)
Most helpful comment
@zvermafia
__call has two arguments. The first one method name and deleteMessage in your case.
The second is an array of array containing method params. chat_id and message_id in your case.
So you could call __call for your deleteMessage like this:
Telegram::__call('deleteMessage', [['chat_id' => $yourChatId, 'message_id' => $yourMessageId]])Consider the datatype of second argument as Array of Array (^_^)