directors-assistant/Program.cs
Adam R. Grey 4aa3162f06 puttiing this on hold because suddenly I hate kafka
I should have just said "cool thing, let me just ctrl+f /.Factory\b/, oh. [delete]"
2021-06-19 04:49:08 -04:00

46 lines
1.7 KiB
C#

using franz;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace directors_assistant
{
class Program
{
public static Config conf;
public static Telefranz telefranz;
static async Task Main(string[] args)
{
conf = JsonConvert.DeserializeObject<Config>(File.ReadAllText("appsettings.json"));
telefranz = new Telefranz(conf.name, conf.bootstrap_servers, conf.kafka_location,
new List<string>(){"proof_of_concept"});
telefranz.addHandler((silver_messages.directorial.execute_command ec) => {
Console.WriteLine("for FUCK'S sake");
Console.WriteLine(JsonConvert.SerializeObject(ec));
if(ec.command == "proof_of_concept")
{
Console.WriteLine("it's a POC");
var content = new StringContent("{\"username\": \"" + conf.name +"\", \"content\": \"hi\"}");
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.PostAsync("super secret url",
content);
Console.WriteLine("I'm P-O-C, I'm dyn-o-mite");
}
Console.WriteLine("it's not a proof of concept call");
});
Console.WriteLine("off we go");
telefranz.StartListening();
await Task.Delay(20000);
Console.WriteLine("alright fuck it");
}
}
}