//+------------------------------------------------------------------+
//| send.mq5 |
//| Copyright 2024, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
string text = "я работаю";
string ID = "-1002113042792";
string token = "7152618530:AAGJJC3zdkmCce3B7i11Dn2JDMh7GqpamyM";
Alert(sendMessage(text,ID,token));
}
int sendMessage(string text, string chatID, string botToken)
{
string baseUrl = "https://api.telegram.org";
string headers = "";
string requestURL = "";
string requestHeaders = "";
char resultData[];
char posData[];
int timeout = 200;
requestURL = StringFormat("%s/bot%s/getUpdates?chat_id=%s&text=%s",baseUrl,botToken,chatID,text);
int response = WebRequest("POST",requestURL,headers,timeout,posData,resultData,requestHeaders);
string resultMessage = CharArrayToString(resultData);
Print(resultMessage);
return response;
}
//+------------------------------------------------------------------+
эта программа выдаёт 2024.03.14 16:08:44.870 send (EURUSD,M1) {"ok":true,"result":[{"update_id":397152442,
2024.03.14 16:08:44.870 send (EURUSD,M1) "message":{"message_id":1,"from":{"id":1256290344,"is_bot":false,"first_name":"\u0418\u0432\u0430\u043d","language_code":"ru"},"chat":{"id":1256290344,"first_name":"\u0418\u0432\u0430\u043d","type":"private"},"date":1710402519,"text":"https://t.me/+GGmqZ_4PKH5kMmVi","entities":[{"offset":0,"length":30,"type":"url"}],"link_preview_options":{"url":"https://t.me/+GGmqZ_4PKH5kMmVi"}}},{"update_id":397152443,
2024.03.14 16:08:44.870 send (EURUSD,M1) "message":{"message_id":2,"from":{"id":1256290344,"is_bot":false,"first_name":"\u0418\u0432\u0430\u043d","language_code":"ru"},"chat":{"id":1256290344,"first_name":"\u0418\u0432\u0430\u043d","type":"private"},"date":1710402690,"text":"https://t.me/+GGmqZ_4PKH5kMmVi","entities":[{"offset":0,"length":30,"type":"url"}],"link_preview_options":{"is_disabled":true}}},{"update_id":397152444,
2024.03.14 16:08:44.870 send (EURUSD,M1) "my_chat_member":{"chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"from":{"id":1256290344,"is_bot":false,"first_name":"\u0418\u0432\u0430\u043d","language_code":"en"},"date":1710402807,"old_chat_member":{"user":{"id":7152618530,"is_bot":true,"first_name":"MQL5send","username":"mql5send_bot"},"status":"left"},"new_chat_member":{"user":{"id":7152618530,"is_bot":true,"first_name":"MQL5send","username":"mql5send_bot"},"status":"administrator","can_be_edited":false,"can_manage_chat":true,"can_ch
2024.03.14 16:08:44.870 send (EURUSD,M1) "channel_post":{"message_id":7,"sender_chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"date":1710413669,"text":"23432"}},{"update_id":397152446,
2024.03.14 16:08:44.870 send (EURUSD,M1) "channel_post":{"message_id":8,"sender_chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"date":1710413675,"text":"kl"}},{"update_id":397152447,
2024.03.14 16:08:44.870 send (EURUSD,M1) "channel_post":{"message_id":9,"sender_chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"date":1710413681,"text":"gfdhturtu"}},{"update_id":397152448,
2024.03.14 16:08:44.870 send (EURUSD,M1) "channel_post":{"message_id":11,"sender_chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"date":1710413752,"text":"435"}},{"update_id":397152449,
2024.03.14 16:08:44.870 send (EURUSD,M1) "channel_post":{"message_id":15,"sender_chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"date":1710414025,"text":"\u044b\u0432\u0430\u044b\u0432\u0430\u044b\u0432\u0430\u044b\u0432\u0430"}},{"update_id":397152450,
2024.03.14 16:08:44.870 send (EURUSD,M1) "channel_post":{"message_id":16,"sender_chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"chat":{"id":-1002113042792,"title":"bot_mt5","type":"channel"},"date":1710414173,"text":"API KEY 7152618530:AAGJJC3zdkmCce3B7i11Dn2JDMh7GqpamyM","entities":[{"offset":8,"length":10,"type":"phone_number"}]}}]}
как от этого оставить только то что в "text":