using franz; using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using TwitchEventSub.Types.EventSubSubscription; using Newtonsoft.Json; using System.Net; namespace twitcher { class Program { static TwitchEventSub.Receiver httpd; static Config twitcherConf; static Telefranz tf; static HttpListener server; static void Main(string[] args) { JsonConvert.DefaultSettings = () => { var s = new JsonSerializerSettings(); s.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); return s; }; if (!File.Exists("appsettings.json")) { Console.Error.WriteLine("appsettings.json was not found!"); twitcherConf = new Config(); File.WriteAllText("appsettings.json", JsonConvert.SerializeObject(twitcherConf, Formatting.Indented)); return; } twitcherConf = JsonConvert.DeserializeObject(File.ReadAllText("appsettings.json")); var httpd = new Httpd(twitcherConf.port); var theRunTask = httpd.go(); var token = OAuthTokenGetter.GetUser(httpd, twitcherConf.clientId, "localhost:8420/login"); //var token = OAuthTokenGetter.DoIt(client, twitcherConf.clientId, twitcherConf.clientSecret, new string[]{"channel:moderate"}); // Telefranz.Configure(name: twitcherConf.kafka_name, bootstrap_servers: twitcherConf.kafka_bootstrap); // Task.WaitAll(Task.Delay(1000)); // tf = Telefranz.Instance; //TODO: throw a request out somewhere asking for public url //tf.ProduceMessage(new silver_messages.directorial.execute_command(){command = "ssl_expose", args = {twitcherConf.port.ToString()}}); var rec = new TwitchEventSub.Receiver(server, twitcherConf.clientId, twitcherConf.clientSecret, twitcherConf.public_uri); var sm = new SilverMeddlistsSpecific(httpd, tf, twitcherConf.clientId); Task.WaitAll(theRunTask); } } }