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.
Malio/app/Utils/Telegram/Process.php

41 lines
1.2 KiB
PHTML

7 years ago
<?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 {
7 years ago
$bot = new Api($_ENV['telegram_token']);
7 years ago
$bot->addCommands(
[
Commands\MyCommand::class,
7 years ago
Commands\HelpCommand::class,
Commands\InfoCommand::class,
Commands\MenuCommand::class,
7 years ago
Commands\PingCommand::class,
Commands\StartCommand::class,
7 years ago
Commands\UnbindCommand::class,
Commands\CheckinCommand::class,
7 years ago
Commands\SetuserCommand::class,
7 years ago
]
);
$update = $bot->commandsHandler(true);
if ($update->getCallbackQuery() !== null) {
Callbacks\Callback::CallbackQueryMethod($bot, $update->getCallbackQuery());
7 years ago
}
7 years ago
if ($update->getMessage() !== null) {
Message::MessageMethod($bot, $update->getMessage());
7 years ago
}
7 years ago
} catch (Exception $e) {
$e->getMessage();
}
}
}