Topics
Replies
Hildeguard
17 May 2024, 18:31
( Updated at: 18 May 2024, 06:36 )
I have the same issue, see https://ctrader.com/forum/calgo-support/43776
I have not figured out any solution, yet, but i am highly interested.
@Hildeguard
Hildeguard
17 May 2024, 18:26
( Updated at: 19 May 2024, 05:16 )
I managed to eliminate the requirement of AccessRights.FullAccess. I create not the url i want to use and then i use Http.Get(myurl) to send the message.
This works still when i run the cBot on my computer, but does not work when i run it in the cTrader cloud.
Does this mean, Network Access is not working when a bot is started in the new cloud?
@Hildeguard
Hildeguard
18 May 2024, 09:10 ( Updated at: 19 May 2024, 05:16 )
RE: Troubles with new version
PanagiotisCharalampous said:
public class MyTeleBot
{
public string Token { get; set; }
public long ChatId { get; set; }
public MyTeleBot(string token, long chatId)
{
UseTls12();
Token = token;
ChatId = chatId;
}
public string Send(string message, params object[] args)
{
var formattedMessage = string.Format(message, args);
var myurl = string.Format("https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}&parse_mode=HTML", Token, ChatId, formattedMessage);
return myurl;
}
private void UseTls12()
{
// Required for SSL/TLS connection with Telegram
// Will work only on .Net 4.5 or higher
// Using number to avoid compilation error
System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;
}
}
and for example onStart or onBar or onTick:
string sendthis = MyTeleBot.Send("{2} | Started this-Bot on {0} with {1}-TF", SymbolName, TimeFrame, Server.Time);
var respo = Http.Get(sendthis);
Print(respo.IsSuccessful); // -> gives False when Bot started in Cloud and True when Bot started locally
@Hildeguard