public void BeginMonitoring() { foreach (var message in botRedditClient.EnumerateUserMessages()) { Console.WriteLine("Message: " + message.Author + message.Body.ToShortString()); if (!TryExtractBerbotPayload(message.Body, out var payloadJson)) { continue; } BerbotPayload payload; try { Console.WriteLine("Parsing JSON: " + payloadJson); payload = JsonUtils.Parse <BerbotPayload>(payloadJson); Console.WriteLine("Payload: " + JsonUtils.ToJson(payload)); foreach (var command in payload.Commands) { Console.WriteLine("Process Command: " + JsonUtils.ToJson(command)); switch (command) { case CreatePollCommand cpc: break; case VotePollCommand vpc: break; } } } catch (Exception e) { DumpException(e); continue; } } }