Add edit_html
This commit is contained in:
parent
a1fcc9dea9
commit
c2c7b60738
27
webhook.php
27
webhook.php
|
@ -41,6 +41,33 @@ function send_html($post_message, $reply=false) {
|
|||
$result = file_get_contents($url, false, $context);
|
||||
}
|
||||
|
||||
// Edits existing pinned message
|
||||
function edit_html($post_message, $reply=false) {
|
||||
global $decoded;
|
||||
global $bot_api;
|
||||
global $chat_id;
|
||||
$message_id = require("message.php");
|
||||
$url = 'https://api.telegram.org/bot' . $bot_api . '/editMessageText';
|
||||
$post_msg = array('chat_id' => $chat_id, 'text' =>$post_message, 'message_id' => $message_id, 'parse_mode' => 'html');
|
||||
if ($reply != false) {
|
||||
if ($reply === true){
|
||||
$post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'};
|
||||
}
|
||||
else {
|
||||
$post_msg['reply_to_message_id'] = $reply;
|
||||
}
|
||||
}
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => http_build_query($post_msg)
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
}
|
||||
|
||||
function add_requirement() {
|
||||
global $command_list;
|
||||
$item_id = $command_list[1];
|
||||
|
|
Loading…
Reference in New Issue