corrects betterAtHome for non discord-V users

This commit is contained in:
Madpeterz 2021-02-15 03:37:09 +00:00
parent 2a1567bafb
commit d9fd10fe23
2 changed files with 9 additions and 6 deletions

View file

@ -5,7 +5,8 @@ using BetterSecondBotShared.Static;
using BetterSecondBot.bottypes; using BetterSecondBot.bottypes;
using System.Threading; using System.Threading;
using static BetterSecondBot.Program; using static BetterSecondBot.Program;
using BetterSecondbot.BetterAtHome;
namespace BetterSecondBot namespace BetterSecondBot
{ {
public class CliExitOnLogout public class CliExitOnLogout
@ -13,15 +14,16 @@ namespace BetterSecondBot
public bool Exited { get { return exitBot; } } public bool Exited { get { return exitBot; } }
protected bool exitBot = false; protected bool exitBot = false;
public SecondBot Bot; public SecondBot Bot;
protected BetterAtHome betterAtHomeService;
protected void keep_alive() protected void keep_alive()
{ {
while (Bot.KillMe == false) while (Bot.KillMe == false)
{ {
string NewStatusMessage = Bot.GetStatus(); string NewStatusMessage = Bot.GetStatus();
NewStatusMessage = NewStatusMessage.Trim();
if (NewStatusMessage != Bot.LastStatusMessage) if (NewStatusMessage != Bot.LastStatusMessage)
{ {
NewStatusMessage = NewStatusMessage.Trim();
if (NewStatusMessage.Replace(" ", "") != "") if (NewStatusMessage.Replace(" ", "") != "")
{ {
Bot.LastStatusMessage = NewStatusMessage; Bot.LastStatusMessage = NewStatusMessage;
@ -30,6 +32,7 @@ namespace BetterSecondBot
} }
Thread.Sleep(1000); Thread.Sleep(1000);
} }
betterAtHomeService = null;
} }
public CliExitOnLogout(JsonConfig Config, bool as_docker, bool use_self_keep_alive) public CliExitOnLogout(JsonConfig Config, bool as_docker, bool use_self_keep_alive)
{ {
@ -38,8 +41,9 @@ namespace BetterSecondBot
if (helpers.botRequired(Config) == true) if (helpers.botRequired(Config) == true)
{ {
Bot = new SecondBot(); Bot = new SecondBot();
Bot.Setup(Config, AssemblyInfo.GetGitHash()); Bot.Setup(Config, AssemblyInfo.GetGitHash());
if(as_docker == true) betterAtHomeService = new BetterAtHome(this, Config);
if (as_docker == true)
{ {
Bot.AsDocker(); Bot.AsDocker();
} }

View file

@ -13,7 +13,7 @@ namespace BetterSecondBot.DiscordSupervisor
{ {
protected int warmup = 0; protected int warmup = 0;
protected BetterRelay relayService; protected BetterRelay relayService;
protected BetterAtHome betterAtHomeService;
protected override void keep_alive() protected override void keep_alive()
{ {
while (exit_super == false) while (exit_super == false)
@ -85,7 +85,6 @@ namespace BetterSecondBot.DiscordSupervisor
controler = new CliExitOnLogout(myconfig, running_as_docker, self_keep_alive); controler = new CliExitOnLogout(myconfig, running_as_docker, self_keep_alive);
controler.Bot.setDiscordClient(DiscordClient); controler.Bot.setDiscordClient(DiscordClient);
relayService = new BetterRelay(controler, this, running_as_docker); relayService = new BetterRelay(controler, this, running_as_docker);
betterAtHomeService = new BetterAtHome(controler, myconfig);
attach_events(); attach_events();
} }