[英]How to send telegram using C#, .NET, Entity Framwork
[HttpPost, ActionName("SendTelegram")]
public async Task<HttpResponseMessage> POST_SendTelegram()
{
var ChatID = "5029678346";
string text = "hallo";
TelegramBotClient Bot = new TelegramBotClient("5577120367:AAFL2ktqKF1YsL4IkXAoj3V-a6lhUvvOOCU");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
await Bot.SendTextMessageAsync(ChatID, text);
try
{
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
}
return Request.CreateResponse(HttpStatusCode.OK, "Send Telegram Success");
}
我想用 Android Studio 和 C# 發送電報。
這是我的代碼……我的語法總是出錯……如何解決?
謝謝
try
{
await Bot.SendTextMessageAsync(ChatID, text);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.