public void Start() { //if (Isrunning) { CheckBotsAlive(); return; } //Isrunning = true; if (this.CommandHandler == null) { this.CommandHandler = new Bots.Commands.CommandHandler(this); } try { if (this.DiscordBot == null) { this.DiscordBot = new Backend.Bots.DiscordBot.Instance(this); } } catch (Exception E) { Console.WriteLine(E); } try { if (this.TwitchBot == null) { this.TwitchBot = new Backend.Bots.TwitchBot.Instance(this); } } catch (Exception E) { Console.WriteLine(E); } System.Threading.Thread.Sleep(5000); if (this.TimeEvents == null) { /*this.TimeEvents.Stop();*/ this.TimeEvents = new Bots.Commands.TimeEvents(); this.TimeEvents.Start(this); } }
public void Stop() { if (!Isrunning) { return; } Isrunning = false; DiscordBot.Client.StopAsync(); TwitchBot.Client.Disconnect(); TimeEvents.Stop(); this.CommandHandler = null; TimeEvents = null; DiscordBot = null; TwitchBot = null; Console.WriteLine("Stopped " + Currency.ID + " Bots"); }