Discussion of article "How to create bots for Telegram in MQL5" - page 13

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Good afternoon.
Can the bot receive messages through the channel?
I have assigned the bot as an administrator. New messages it sees, but the text is always a blank line.
Here it is always a blank line.Good afternoon.
Can the bot receive messages through the channel?
I have assigned the bot as an administrator. It sees new messages, but the text is always a blank line.
Here it is always a blank line.In the channel_post field everything comes in https://core.telegram.org/bots/api#update.
It would be nice to refine the class. I will add the channel_post_text field to CCustomMessage. And fill it in GetUpdates().
Only for some reason all these fields are null for chat from a channel.
For a channel you should look at the channel_post field, not the message field. channel_post is also of Message type.
I get the text:
But other fields are not:
The first three fields receive the value. But the last three fields (for fields like Chat and From) do not receive the value. Where to look?
Figured it out.
channel_post.chat_id - can be negative, and I took it for a crooked value.
channel_post.from.first_name - from - optional field, can be without it. In general, everything is here https://core.telegram.org/bots/api#message
I tried this code in OnInit() to send a message to my channel. but it does not work, can you give me example on how to send message to a channel or group chat?
thanks
bot.SendMessage("t.me/BotSignals","Hello",false,false);
Please help me with advice. I added theterminal settings. Through the browser the request is executed successfully https://api.telegram.org/bot<token>/sendMessage?chat_id=<id>&text=test.
The lines of code below are executed, but SendMessage returns error code 5203 (Error as a result of HTTP request execution). The bot.GetMe() method returns the same 5203 error.
What could be the problem? Thanks!