async Task HttpRequestsHandler(HttpContext ctx, Func <Task> next) { var path = ctx.Request.Path.ToString(); if (!IsDisposed && _isInit && path.Contains(_pathWithBotname)) { //When webhook of current bot. var requestBodyStr = await ctx.GetRequestBodyText(); var update = JsonConvert.DeserializeObject <Update>(requestBodyStr, JsonSettings); var args = new UpdateReceivedEventArgs(update); UpdateReceived?.Invoke(this, args); } else { await next(); } }
void Handler(object sender, UpdateEventArgs args) { var passedArgs = new UpdateReceivedEventArgs(args.Update); UpdateReceived?.Invoke(sender, passedArgs); }