forked from YehudaEi/TelegramBots-Class
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.php
41 lines (37 loc) · 1.57 KB
/
example.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
<?php
/*******************************************
*
* https://t.me/returnJson_MYBOT
*
* Created by @YehudaEisenberg
*
*******************************************/
define('BOT', array(
"token" => "<TOKEN>",
"webHookUrl" => "https://telegram.org/returnJson_MYBOT.php",
"allowed_updates" => array ("message", "edited_message", "channel_post", "edited_channel_post", "callback_query", "inline_query", "poll", "chosen_inline_result"),
"debug" => false
));
require_once("src/autoload.php");
$bot->SetUpdate($update);
$bot->SetParseMode('MarkDown');
if($message == "callback"){
$keyboard = Helpers::makeKeyboard(array(array("callback_data is your id" => $chatId)));
$bot->sendMessage($chatId, "callback", $keyboard, $messageId);
}
elseif($message == "/start"){
$keyboard = Helpers::makeKeyboard(array(array('Switch to inline' => array('switch_inline_query_current_chat' => ""))));
$bot->sendMessage($chatId, "hello,\nSend me the text \"`callback`\" to get a message with a button.\n\nCreated by @YehudaEisenberg.", $keyboard, $messageId);
}
elseif(isset($InlineQId)){
$inlineRes = array(array(
"type" => "article",
"id" => "1",
"title" => "Click me!",
"message_text" => "```\n".json_encode($update, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."```",
"parse_mode" => $bot->GetParseMode()
));
$bot->answerInlineQuery($InlineQId, json_encode($inlineRes));
}
else
$bot->sendMessage($chatId,"```\n".json_encode($update, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."```", null, $messageId);