<?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 ответов

60 просмотров
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

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

Обсуждают сегодня

Эх кто-то пришел и весь праздник испортил :( You need complex FBX scene importing setup to change things on import? good luck with that. You need navigation and pathfinding? g...
Serg Gini
5
на D можно построить абсолютно разный архитект, как объектный, так и нет, оч широкий простор для принятия решений. Однако проблема в том, что большинство книг об айтишной архи...
Constantin_FV
1
ну кстати в ноду 22 завезли движок 12.4 с WasmGC. А как у нас дела с wasm, мб в дискорде что-то кто-то писал-отвечал? Из BetterC, конечно, тоже можно выжать что-нибудь, но хот...
Constantin_FV
1
День добрый. Стандартная библиотека phobos (std.array) ссылается на внешнюю фунцию _d_newarrayUTrace и при сборке с ключом profile-gc эта ссылка остаётся неопределённой. Никак...
slacker linuxoid
5
а у нас кто-нибудь разбирается в матлаб? Накопал статью по замощению Фодерберга, о нём вообще мало инфы в сети. Но там матлабовский код, который нужно через песочницу по сути ...
Constantin_FV
1
а что на D можно делать под 3й Godot ?
Dmitry Ponyatov
3
ну эт я в вове такой, а тут я... на расте надо писать, на д куча проблем, годот тоже не лапочка. сидишь в афиге, а я еще бросил курить... и думаешь, а почему Я? хд.
Vi
1
string xczhojoxueaflfhhygcc ="xczhojoxueaflfhhygcc"; long xczhojoxueaflfhhygcc_2 =1368962155; import std.conv: text; writeln(text(xczhojoxueaflfhhygcc, " ", xczhojoxueaflfhhyg...
Constantin_FV
6
Доброго времени суток. Сейчас я работаю над своей архитектурой Component / Systems. Если просто, это то что использовали до дробления на ECS. Потому что ECS это все таки нишев...
Vi
26
А кто-нибудь встречал в пакетах\графических движках генерацию мозаик, Пенроуз и т.п.? На гитхабе вижу около сотни репов, ток по Пенроузу + разбросаны сниппеты по сети, но мб г...
Constantin_FV
3
Карта сайта