public static Report FromBot(AnalyzerBot bot) { return(new Report( new ReportData( bot.Analyzer.Statistics, BotInfo.FromBot(bot) ) )); }
private static async Task Main() { UpdateTitle(); Console.Write("Input the channel name you want stats for: "); var channelName = Console.ReadLine(); var credentialsPath = "./twitch_credentials.json"; if (!File.Exists(credentialsPath)) { Console.Write("Input the path where your twitch credentials are stored: "); credentialsPath = Console.ReadLine(); } var bot = new AnalyzerBot(ReadCredentials(credentialsPath), channelName); string basePath = Path.Combine(Directory.GetCurrentDirectory(), "statistics"); if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } var statisticsWriter = new ReportWriter( $"{basePath}/{bot.Channel}/", bot.Analyzer, new List <IReportFormatter>() { new JsonFormatter(), new MarkdownFormatter() } ); var timer = new Timer(15_000) { AutoReset = true, Enabled = true }; timer.Elapsed += (sender, e) => { UpdateTitle(); statisticsWriter.Save(bot); }; bot.OnMessageReceived += (_, args) => LogMessage(args.Message); await bot.SetupAndListenAsync(); }