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

View file

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