Из класса Telegram SDK обратиться к MySQL
Вот мой код
<?php
// shows addresses from Itera database
namespace Longman\TelegramBot\Commands\UserCommands;
use Longman\TelegramBot\Commands\UserCommand;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
class TicketsCommand extends UserCommand
{
protected $name = 'Tickets'; // Your command's name
protected $description = 'A command list addreses'; // Your command description
protected $usage = '/tickets'; // Usage of your command
protected $version = '1.0.0';
protected $db;
public function db()
{
$db = new mysqli('localhost', 'ыаыв', 'ыафааы', '00000');
return 'ha!';
}
public function execute()
{
//$db = new mysqli('localhost', 'вавыа', 'вава', 'вава');
$message = $this->getMessage(); // Get Message object
$chat_id = $message->getChat()->getId(); // Get the current Chat ID
$data = [ // Set up the new message data
'chat_id' => $chat_id, // Set Chat ID to send the message to
'text' => 'This is just a Test...', // Set message to send
];
return Request::sendMessage($data); // Send message!
}
}
Как только в коде раскомментирую строку на коннект к БД, или использую функцию, то бот зависает. Логи апача пустые. Помогите пожалуйста.