/**
* App constructor.
*/
public function __construct()
{
parent::__construct();
$this->match('/', function () {
return '/';
});
/**
* process messages
*/
$this->match('update', function () {
$telegram = new Client(BOT_TOKEN);
$handler = new Handler($telegram);
return $handler->handle();
});
/**
* update hook settings/api
*/
$this->match('hook', function () {
$telegram = new Api(BOT_TOKEN);
$telegram->removeWebhook();
if (USE_WEBHOOK) {
$telegram->setWebhook(WEBHOOK, '../server-setup/files/cert/nginx.crt');
return 'hook set';
}
return 'hook-removed';
});
}