public static void Main(string[] args) { _listen = true; Pairs = new List <ChannelPair>(); var discordFilenames = Directory.GetFiles(".", "*.discord.json"); foreach (var discordFilename in discordFilenames) { var ircFilename = discordFilename.Replace(".discord.json", ".irc.json"); if (File.Exists(ircFilename)) { var discordInfo = JsonConvert.DeserializeObject <DiscordConnectionInfo>(File.ReadAllText(discordFilename)); var ircInfo = JsonConvert.DeserializeObject <IrcConnectionInfo>(File.ReadAllText(ircFilename)); var pair = new ChannelPair(new IrcConnection(ircInfo), discordInfo); if (args.Contains("noprompt")) { pair.EnableConsoleLogging = false; } Console.WriteLine("Connecting..."); pair.Connect().Wait(); Console.WriteLine("Ready."); Pairs.Add(pair); } } MainAsync(args).GetAwaiter().GetResult(); }
private static async Task LoadChannel(DiscordConnectionInfo discordInfo, IrcConnectionInfo ircInfo) { var pair = new ChannelPair(new IrcConnection(ircInfo) { EnableConsoleLogging = WriteToConsole }, discordInfo) { EnableConsoleLogging = WriteToConsole }; if (WriteToConsole) { Console.WriteLine("Connecting..."); } await pair.Connect(); if (WriteToConsole) { Console.WriteLine("Ready."); } Pairs.Add(pair); }