-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathawokado-robot
35 lines (25 loc) · 940 Bytes
/
awokado-robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
use AdamWojs\AwokadoRobot\AwokadoRobot;
use AdamWojs\AwokadoRobot\Notification\SlackWebhookTransportFactory;
use AdamWojs\AwokadoRobot\Menu\Provider\Awokado\AwokadoMenuProviderFactory;
use AdamWojs\AwokadoRobot\Menu\Provider\ZieloneTarasy\ZieloneTarasyMenuProviderFactory;
use AdamWojs\AwokadoRobot\LoggerFactory;
$restaurants = [
'awokado' => AwokadoMenuProviderFactory::class,
'zielone-tarasy' => ZieloneTarasyMenuProviderFactory::class
];
if ($argc < 3) {
exit("usage: $argv[0] <restaurant> <webhook-url>");
}
$restaurant = $argv[1];
$webhook = $argv[2];
if(empty($restaurants[$restaurant])) {
exit("unknown restaurant");
}
$menuProvider = $restaurants[$restaurant]::create();
$transport = SlackWebhookTransportFactory::create($webhook);
$robot = new AwokadoRobot($menuProvider, $transport);
$robot->setLogger(LoggerFactory::get());
$robot->run();