<?Php // Replace YOUR_BOT_TOKEN with your bot token obtained from BotFather define('BOT_TOKEN',

'6919487998:AAGjmm3yfEwFbJ03ZpkiayFdlKcxMzo8fYI');

// Define the base URL for the Telegram Bot API
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');

// Get updates from Telegram
$update = file_get_contents('php://input');
$update = json_decode($update, true);

// Define the chat ID and message ID
$chat_id = $update['message']['chat']['id'];
$message_id = $update['message']['message_id'];

// Define the user's first name
$user_first_name = $update['message']['from']['first_name'];

// Define the message to be sent
$message = "Hello! Welcome to my bot!";

// Define the URL for sending messages
$url = API_URL."sendMessage?chat_id=".$chat_id."&text=".$message;

// Send the message to the user
file_get_contents($url);

// Define the loading animation message to be edited
$edit_message = "Loading...";

// Define the URL for editing messages
$edit_url = API_URL."editMessageText?chat_id=".$chat_id."&message_id=".$message_id."&text=".$edit_message;

// Edit the message 5 times with a loading animation
for ($i = 0; $i < 5; $i++) {
// Send the edit message request to the Telegram Bot API
file_get_contents($edit_url);
// Wait for 1 second before sending the next edit message request
sleep(1);
}

// Define the final message to be edited
$final_message = "Welcome! ".$user_first_name." ([user tgid deep link](tg://user?id=".$update['message']['from']['id']. "))!";

// Define the URL for editing the final message
$final_edit_url = API_URL."editMessageText?chat_id=".$chat_id."&message_id=".$message_id."&text=".$final_message;

// Edit the message to the final message
file_get_contents($final_edit_url);
?>
I don't know why the edit message text is not working, any body know?

21 ответов

119 просмотров
Coder Ajinkya- Автор вопроса

@s0m31_tg

message_id +1 ya -1🤔

Coder Ajinkya- Автор вопроса
⏤͟͞MrTechno🇮🇳
message_id +1 ya -1🤔

😕Mahit nahi yaar, kya problem ahe saala

Coder Ajinkya- Автор вопроса
s0m31 🇷🇺
English pls

*Don't know what is problem there

Wait, you leaked a token, didn't ya?

Coder Ajinkya
*Don't know what is problem there

Did you write this code yourself?

Coder Ajinkya- Автор вопроса
Coder Ajinkya- Автор вопроса
dotvhs
Did you write this code yourself?

Naa, I have main script with this, I just give example from Ai here

Coder Ajinkya
Naa, I have main script with this, I just give exa...

Welp I'm not dealing with Ai crap. I'm not even a php coder. The only thing I allow ai to do with my code is writing comments/javadoc (I am too lazy to do that myself)

We aren't here to fix ai coding mistakes

Coder Ajinkya- Автор вопроса

😐I am not asking to fix, just need the point where is mistake.

Coder Ajinkya- Автор вопроса
s0m31 🇷🇺
Welp I'm not dealing with Ai crap. I'm not even a ...

Last pic on you Profile is of Ravan or any other god?

Coder Ajinkya- Автор вопроса
Coder Ajinkya
Last pic on you Profile is of Ravan or any other g...

Welp ive found this guy on "The last boss of the tech support" meme. Just found it funny to place on pfp since coders are looking like that sometimes aswell when creating workarounds

// Replace YOUR_BOT_TOKEN with your bot token obtained from BotFather define('BOT_TOKEN', 'YOUR_BOT_TOKEN'); // Define the base URL for the Telegram Bot API define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/'); // Get updates from Telegram $update = file_get_contents('php://input'); $update = json_decode($update, true); // Define the chat ID and message ID $chat_id = $update['message']['chat']['id']; $message_id = $update['message']['message_id']; // Define the user's first name $user_first_name = $update['message']['from']['first_name']; // Define the message to be sent $message = "Hello! Welcome to my bot!"; // Define the URL for sending messages $url = API_URL."sendMessage?chat_id=".$chat_id."&text=".$message; // Send the message to the user file_get_contents($url); // Define the loading animation message to be edited $edit_message = "Loading..."; // Define the URL for editing messages $edit_url = API_URL."editMessageText?chat_id=".$chat_id."&message_id=".$message_id."&text=".$edit_message; // Edit the message 5 times with a loading animation for ($i = 0; $i < 5; $i++) { // Send the edit message request to the Telegram Bot API file_get_contents($edit_url); // Wait for 1 second before sending the next edit message request sleep(1); } // Define the final message to be edited $final_message = "Welcome! ".$user_first_name." ([user tgid deep link](tg://user?id=".$update['message']['from']['id']. "))!"; // Define the URL for editing the final message $final_edit_url = API_URL."editMessageText?chat_id=".$chat_id."&message_id=".$message_id."&text=".$final_message; // Edit the message to the final message and get the response as JSON $response = file_get_contents($final_edit_url); // Parse the response JSON and get the message ID for the edited message $result = json_decode($response, true)['result']; $message_id = $result['message_id']; // Update the $message_id variable with the new message ID // This is needed in case there are any further edits to the message $message_id = $result['message_id'];

Don't share your bot token

Похожие вопросы

Карта сайта