public static void processUpdates() { var up = Telegram.getUpdates(lastUpdate).Result; Console.WriteLine("Updates: {0}", up.Length); for (int i = 0; i < up.Length; i++) { var currentUpdate = up[i]; if (currentUpdate.update_id >= lastUpdate) { lastUpdate = currentUpdate.update_id + 1; } if (currentUpdate.edited_message != null) { currentUpdate.message = currentUpdate.edited_message; // ahax. } Console.WriteLine(JsonConvert.SerializeObject(currentUpdate)); try { if (currentUpdate.message != null) { processIndividualUpdate(currentUpdate); } } catch { Console.WriteLine("UPDATE FAIL"); } } }
public static void processUpdates() { var up = Telegram.getUpdates(lastUpdate); if (up == null) { Console.WriteLine("TGAPI Response failure update==null"); return; } Console.WriteLine("Updates: {0}", up.Length); if (up.Length == 0) { allowProcessUpdates = true; } for (var i = 0; i < up.Length; i++) { var currentUpdate = up[i]; if (currentUpdate.update_id >= lastUpdate) { lastUpdate = currentUpdate.update_id + 1; } if (currentUpdate.edited_message != null) { currentUpdate.message = currentUpdate.edited_message; // ahax. } if (allowProcessUpdates) { #if DEBUG //Console.WriteLine(JsonConvert.SerializeObject(currentUpdate)); #endif { if (currentUpdate.message != null) { try { processIndividualUpdate(currentUpdate); } catch (Exception E) { Helpers.writeStack(E.ToString()); } } } } else { Console.WriteLine("Skipping update due to startup condition...."); } } }