Answer the question
In order to leave comments, you need to log in
Why does Telegram bot give 502 Bad Gateway on Http request?
There is a telegram bot on ASP.NET with the following code:
private void Start()
{
using (WebApp.Start<Startup>("http://*:8080/"))
{
Bot.token.SetWebhookAsync("https://адрес/WebHook").Wait();
}
}
public class Startup
{
public static void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
config.Routes.MapHttpRoute("WebHook","{controller}");
app.UseWebApi(config);
}
}
public async Task<IHttpActionResult> Post(Update update)
{
var message = update.Message;
if (message.Type == MessageType.TextMessage)
{
if (message.Text=="/game")
{
await Bot.token.SendTextMessageAsync(message.Chat.Id,"Молоток");
}
else
{
await Bot.token.SendTextMessageAsync(message.Chat.Id, "Не молоток");
}
}
return Ok();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question