-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.php
44 lines (32 loc) · 959 Bytes
/
init.php
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
36
37
38
39
40
41
42
43
44
<?php
include('vendor/autoload.php');
include('TelegramBot.php');
include('Weather.php');
$telegramApi = new TelegramBot();
$weatherApi = new Weather();
while (true) {
sleep(2);
$updates = $telegramApi->getUpdates();
foreach($updates as $update){
if(isset($update->message->location)){
$weatherApi->getWeather($apdate->message->location->latitude, $update->message->location->longitude);
switch ($result->weather[0]->main) {
case 'Clear':
$response = "Aysor arevot or e!";
break;
case 'Clouds':
$response = "Aysor ampamac e, amen depqum vercreq andzrevanoc!";
break;
case 'Rain':
$response = "Drsum andzrev e, vercreq andzrevanoc!";
break;
default:
$response = "Nayeq patuhanic, ktesneq!";
break;
}
} else{
$telegramApi->sendMessage($update->message->chat->id, 'Send please your location');
}
$telegramApi->sendMessage($update->message->chat->id, 'Hello!');
}
}