Files
foodsi-bot/index.php

20 lines
578 B
PHP

<?php
use Kplaczek\FoodsiBot\BotService;
use Kplaczek\FoodsiBot\FoodsiService;
use Kplaczek\FoodsiBot\HomeassistantService;
require_once 'vendor/autoload.php';
date_default_timezone_set('Europe/Warsaw');
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
$_ENV['DEBUG'] = false;
if ($argc === 2 and isset($argv[1]) && $argv[1] === '--debug') {
$_ENV['DEBUG'] = true;
}
$client = new GuzzleHttp\Client();
$homeassistant = new HomeassistantService($client);
$foodsi = new FoodsiService($client);
$bot = new BotService($homeassistant, $foodsi);
$bot->run();