-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtlgwh.php
More file actions
36 lines (33 loc) · 1.2 KB
/
tlgwh.php
File metadata and controls
36 lines (33 loc) · 1.2 KB
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
<?php
/**
* Created by PhpStorm.
* User: KarpSA
* Date: 20.11.2017
* Time: 18:44
*/
include_once("etc/init.php");
try{
//Форматируем входные данные
$content=file_get_contents("php://input");
file_put_contents('lastq',$content);
$req = new \modules\telegram\hRequest($content);
//Если комманда отдаем ее CommandRouter
if($req->cmd!=null && $req->chain==null && $req->isCallback==false){
$cr=new \modules\telegram\CommandRouter($req);
$cr->routeCommand($req->cmd);
}elseif($req->cmd==null && $req->chain!=null && $req->isCallback==false){
$cr=new \modules\telegram\CommandRouter($req);
$cr->routeCommand($req->chain['cmd'],$req->chain['action']);
}elseif($req->isCallback==true && $req->cmd==null){
$qr=new \modules\telegram\QueryRouter($req);
$qr->routeQuery($req->getQuery());
}elseif($req->isCallback==true && $req->cmd!=null){
$cr=new \modules\telegram\CommandRouter($req);
$cr->routeCommand($req->cmd);
}else{
$msg = new \modules\telegram\MessageRouter($req);
$msg->routeMessage();
}
}catch(\TelegramBot\Api\Exception $e){
echo $e->getMessage();
}