<?php

use Database\Profile;
use Database\Settings;

if (Settings::getSettings('type') == 'coin') {
    $button_start = $button_shopstart;
}
if (Settings::getSettings('cansendQus') == '1') {
    $button_start['inline_keyboard'][2][] = ["text" => msg('Sendqu'), "callback_data" => "sendqus"];
    $button_genders['inline_keyboard'][2][] = ["text" => msg('getCoin'), "callback_data" => "getCoin"];
}

if ($Telegram->isPrivate()) {
    try {

        foreach (['asli', 'offline', 'Lock', 'getCoin', 'UpdateTime', 'profile', 'SendQusByuser', 'GameVsFriends', 'CallBackPv', 'searchUser'] as $file) {
            include 'pl/' . $file . '.php';
        }
        if ($user_rank == 'admin') {
            foreach (['shop', 'ads', 'settings', 'setCoinLock', 'paneladmin', 'setCountInvite', 'setCoinInvite', 'selectBotType', 'sendMsgForUser', 'bots', 'Users', 'admins'] as $file) {
                include 'pl/' . $file . '.php';

            }
        }


    } catch (\Exception $e) {

        error_log('Error run bot : ' . $e . ' Chatid :' . $chatid . ' User Data = ' . $user_data);
        $Telegram->sendMessage($chatid, msg('un_error'), 'html', false);
        $Telegram->sendMessage('82267967', 'chatid = ' . $chatid . ' data = ' . $user_data . ' command = ' . $command . ' imgame ' . Profile::getUser($chatid)->ingame, 'html', false);
    }
} elseif ($Telegram->isSupergroup() or $Telegram->isGroup()) {
    foreach (['Group', 'SendQusByuserOnGroup'] as $file) {
        include 'pl/' . $file . '.php';
    }

} elseif ($Telegram->isCallbackQuery()) {
    foreach (['CallBack'] as $file) {
        include 'pl/' . $file . '.php';
    }
}

if ($Telegram->isInlineQuery()) {

    foreach (['inline_query'] as $file) {
        include 'pl/' . $file . '.php';
    }

}
if ($Telegram->isMessage() and $Telegram->message()->issetViaBot()) {
    foreach (['ViaBot'] as $file) {
        include 'pl/' . $file . '.php';
    }
}
if ($Telegram->isEditedMessage() and $Telegram->edited_message()->issetViaBot()) {
    foreach (['ViaBot'] as $file) {
        include 'pl/' . $file . '.php';
    }
}
