fixs a crash if you try and start the bot without discord

This commit is contained in:
Madpeter 2021-08-21 22:32:50 +01:00
parent 51b1feeb6b
commit 4e7b4016f3
2 changed files with 8 additions and 2 deletions

View file

@ -85,10 +85,12 @@ namespace BetterSecondBot.DiscordSupervisor
controler = null; controler = null;
} }
controler = new Cli(myconfig, running_as_docker, self_keep_alive, use_folder); controler = new Cli(myconfig, running_as_docker, self_keep_alive, use_folder);
controler.getBot().setDiscordClient(DiscordClient); if (myconfig.DiscordFull_Enable == true)
{
controler.getBot().setDiscordClient(DiscordClient);
}
relayService = new BetterRelay(controler, this, running_as_docker); relayService = new BetterRelay(controler, this, running_as_docker);
attach_events(); attach_events();
} }
} }
} }

View file

@ -57,6 +57,10 @@ namespace BetterSecondBot.bottypes
} }
public bool discordReady() public bool discordReady()
{ {
if (myconfig.DiscordFull_Enable == false)
{
return false;
}
if (DiscordLink == null) if (DiscordLink == null)
{ {
DiscordReadyWhyFailed = "No client"; DiscordReadyWhyFailed = "No client";