public KellyHoshiraBot(SecretKeys keys, DiscordSocketConfig config) { // Set the Instance Instance = this; Initialized = false; // Set the Secret Keys Keys = keys; // Set Local Variables NetworkStatus = OnlineStatus.Offline; // Create the Client m_client = new DiscordSocketClient(config); m_client.Log += Log; // Setup the Commands m_commandService = new CommandService(); _services = new ServiceCollection() .AddSingleton(m_client) .AddSingleton(m_commandService) .BuildServiceProvider(); // Setup Events m_client.MessageReceived += MessageReceived; }
public static SecretKeys Load(string fileName) { List <string> results = new List <string>(); FileStream fileStream = new FileStream(fileName, FileMode.Open); using (StreamReader reader = new StreamReader(fileStream)) { while (!reader.EndOfStream) { var line = reader.ReadLine(); //Debug.WriteLine(line); // Parse out Empty Lines or Comments if (string.IsNullOrWhiteSpace(line)) { continue; } else if (line[0] == '#') { continue; } // Add to the list results.Add(line); } } SecretKeys keys = new SecretKeys(results[0], results[1], results[2]); Debug.WriteLine("Parsed Keys"); Debug.WriteLine(string.Format("Client ID: {0}", keys.ClientID)); Debug.WriteLine(string.Format("Client Secret: {0}", keys.ClientSecret)); Debug.WriteLine(string.Format("UserToken: {0}", keys.UserToken)); return(keys); }
public KellyHoshiraBot(SecretKeys keys) : this(keys, new DiscordSocketConfig() { LogLevel = LogSeverity.Info }) { }