You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
968 B
PHP
38 lines
968 B
PHP
<?php
|
|
|
|
namespace App\Utils\Telegram;
|
|
|
|
use App\Models\User;
|
|
use App\Services\Config;
|
|
use Telegram\Bot\Api;
|
|
use Exception;
|
|
|
|
class Process
|
|
{
|
|
public static function index()
|
|
{
|
|
try {
|
|
$bot = new Api(Config::get('new_telegram_token'));
|
|
$bot->addCommands(
|
|
[
|
|
Commands\HelpCommand::class,
|
|
Commands\StartCommand::class,
|
|
]
|
|
);
|
|
$update = $bot->commandsHandler(true);
|
|
|
|
if ($update->getCallbackQuery() !== null) {
|
|
$id = $update->getCallbackQuery()->getFrom()->getId();
|
|
$user = User::where('telegram_id', $id)->first();
|
|
Callback::CallbackQueryMethod($user, $bot, $update->getCallbackQuery());
|
|
}
|
|
|
|
// $Message = $update->getMessage();
|
|
// $MessageData = $Message->getText();
|
|
|
|
} catch (Exception $e) {
|
|
$e->getMessage();
|
|
}
|
|
}
|
|
}
|