Discussion of article "How to create bots for Telegram in MQL5" - page 49 1...4243444546474849505152535455 New comment Sergey Zhilinskiy 2022.09.14 18:33 #481 Vladimir Pastushak #:I understand it, but I don't know how to implement it. Is there a code example? https://api.telegram.org/bot{token bot}/deleteWebhook In the browser do once like this https://api.telegram.org/bot856203438:AAG1IDoQ_Fey5Wu88Jo-_YKCYIaeEnVxmRs/deleteWebhook Vladimir Pastushak 2022.09.14 20:25 #482 Sergey Zhilinskiy #: In the browser do one time like this https://api.telegram.org/bot856203438:AAG1IDoQ_Fey5Wu88Jo-_YKCYIaeEnVxmRs/deleteWebhook Thank you! I think that's enough. Vladimir Pastushak 2022.09.15 09:59 #483 Sergey Zhilinskiy #: In the browser do one time like this https://api.telegram.org/bot856203438:AAG1IDoQ_Fey5Wu88Jo-_YKCYIaeEnVxmRs/deleteWebhook It didn't work, can you show the code or what needs to be done? I'm not good with telegram bots unfortunately..... Renat Akhtyamov 2022.09.16 14:52 #484 Vladimir Pastushak #:It didn't work, can you show me the code or what needs to be done? I'm not good with telegram bots unfortunately..... write your own, without the bible, it's very simple.There is also written how to overcome this feature. https://tlgrm.ru/docs/bots/api Справочник по Telegram Bot API tlgrm.ru Методы и объекты Bot API в Telegram. Vladimir Pastushak 2022.11.13 15:55 #485 Webrequest_dll.mqh POST requests don't work ((( Aliaksandr Kazunka 2022.12.11 13:40 #486 Simple code, but sending a photo file doesn't work //+------------------------------------------------------------------+ //|5555.mq4 | //| Copyright 2022, MetaQuotes Software Corp. | | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2022, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #property strict #include <Telegram.mqh> /--- Input parameters const string TelegramBotToken = "5499894508:AAGQFdha3N84sPsIPAw2Sfb-kGSnpdMKQWER"; const long ChatId = -1001682411943; const string InpChannelName = "@************"; const string TelegramApiUrl = "https://api.telegram.org"; // Add this to Allow URLs //--- Global variables CCustomBot bot; int getme_result; //+------------------------------------------------------------------+ //| Expert initialisation function| //+------------------------------------------------------------------+ int OnInit() { //--- SET TOKEN bot.Token(TelegramBotToken); //--- check token getme_result=bot.GetMe(); //--- run timer EventSetTimer(3); OnTimer(); //---DONE. //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialisation function| //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| OnTimer| //+------------------------------------------------------------------+ void OnTimer() { //--- show error message end exit if(getme_result!=0) { Comment("Error: ",GetErrorDescription(getme_result)); return; } //--- show bot name Comment("Bot name: ",bot.Name()); //---{ insert your code here } } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Expert tick function| //+------------------------------------------------------------------+ void OnTick() { //--- int res=bot.SendMessage(InpChannelName,"Running a test " +TimeToString(TimeCurrent())); int ac=bot.SendChatAction(InpChannelName,ACTION_UPLOAD_PHOTO); string filepath = "C:\mypic.gif"; string photo_id; int pic=bot.SendPhoto(photo_id,InpChannelName,filepath); } //+------------------------------------------------------------------+ Messages come in with no problem, photo is not sending. Help to solve the problem Discover new MetaTrader 5 opportunities with MQL5 community and services 2022.12.11 www.mql5.com MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions Vladimir Pastushak 2022.12.11 13:49 #487 sportoman #:Simple code, but sending a photo file doesn't work Messages come in with no problem, photo is not sending. Help to solve the problem You have messed up the paths. Take here the path where you save Aliaksandr Kazunka 2022.12.11 13:55 #488 It's not a path error. It's a Webrequest error. I've tried everything, no matter where I saved the file. Vladimir Pastushak 2022.12.11 14:39 #489 sportoman Webrequest error. I've tried everything, no matter where I saved the file. This function works in the sandbox. Only inside the files directory of the metatrader terminal. I use this code myself, the code works Aliaksandr Kazunka 2022.12.11 18:25 #490 Vladimir Pastushak #:This function works in the sandbox. Only inside the files directory of the metatrader terminal. I use this code myself, the code works Indeed, I removed the path, left the file name and started sending from MQL4\Files. Thank you. One more question - how to pass HTML text formatting to the Telegram bot? 1...4243444546474849505152535455 New comment
I understand it, but I don't know how to implement it. Is there a code example?
https://api.telegram.org/bot{token bot}/deleteWebhookIn the browser do once like this https://api.telegram.org/bot856203438:AAG1IDoQ_Fey5Wu88Jo-_YKCYIaeEnVxmRs/deleteWebhookIn the browser do one time like this https://api.telegram.org/bot856203438:AAG1IDoQ_Fey5Wu88Jo-_YKCYIaeEnVxmRs/deleteWebhook
Thank you! I think that's enough.
In the browser do one time like this https://api.telegram.org/bot856203438:AAG1IDoQ_Fey5Wu88Jo-_YKCYIaeEnVxmRs/deleteWebhook
It didn't work, can you show the code or what needs to be done? I'm not good with telegram bots unfortunately.....
It didn't work, can you show me the code or what needs to be done? I'm not good with telegram bots unfortunately.....
write your own, without the bible, it's very simple.
There is also written how to overcome this feature.
https://tlgrm.ru/docs/bots/api
Simple code, but sending a photo file doesn't work
Messages come in with no problem, photo is not sending. Help to solve the problem
Simple code, but sending a photo file doesn't work
Messages come in with no problem, photo is not sending. Help to solve the problem
You have messed up the paths. Take here the path where you save
This function works in the sandbox. Only inside the files directory of the metatrader terminal.
I use this code myself, the code works
This function works in the sandbox. Only inside the files directory of the metatrader terminal.
I use this code myself, the code works
Indeed, I removed the path, left the file name and started sending from MQL4\Files. Thank you.
One more question - how to pass HTML text formatting to the Telegram bot?