<?php
require_once 'config.php';
$db = mysqli_connect('localhost', $databaseUser, $databasePass, $databaseName);
#==============================================#
function MahdyKing($method, $datas = [])
{
    $url = "https://api.telegram.org/bot" . API_KEY . "/" . $method;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $datas);
    $res = curl_exec($ch);
    if (curl_error($ch)) {
        var_dump(curl_error($ch));
    } else {
        return json_decode($res);
    }
}
#==============================================#
mkdir("../data");
mkdir("../data/kalamat");
file_get_contents($domin . '/config/table.php');
file_get_contents('https://api.telegram.org/bot' . API_KEY . '/setWebHook?url=' . $domin . '/RalfMainFile.php');
#==============================================#
$usernamebot = MahdyKing('getMe')->result->username;
if (!$db)
{
    die("Connection db failed: " . mysqli_connect_error());
} else {
    echo "<h1>The robot was runned ...<br><a href='https://t.me/$usernamebot'>Click to start robot</a><h1>";
    MahdyKing('sendMessage', ['chat_id' => $admins[0], 'text' => "<b>The robot was runned ...\nSend /start or /panel\nCode By @artin_fe</b>", 'parse_mode' => 'html']);
}
?>