-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdebugerbot.php
More file actions
25 lines (23 loc) · 787 Bytes
/
debugerbot.php
File metadata and controls
25 lines (23 loc) · 787 Bytes
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
<?php
/**
* Telegram Bot Debuger access token и URL.
*/
$access_token = 'XXXXX:XXXXXXXXXXXXXXXXXXXXXXX';
$api = 'https://api.telegram.org/bot' . $access_token;
/**
* Задаём основные переменные.
*/
$output = json_decode(file_get_contents('php://input'), TRUE);
@$chat_id = $output['message']['chat']['id'];
@$message = $output['message']['text'];
switch($message) {
case '/start':
sendMessage($chat_id, "\xF0\x9F\x93\xA1 бот debugger на связи!");
break;
default:
$myDebug = "<pre>". json_encode($output) ."</pre>"; sendMessage($chat_id, $myDebug);
break;
}
function sendMessage($chat_id, $message) {
file_get_contents($GLOBALS['api'] . '/sendMessage?chat_id=' . $chat_id . '&text=' . urlencode($message) . '&parse_mode=html');
}