discord-v status fixs

This commit is contained in:
Madpeterz 2021-01-31 02:45:30 +00:00
parent 3f85d1bae8
commit 108578656b
5 changed files with 64 additions and 53 deletions

View file

@ -209,6 +209,8 @@ namespace BetterSecondBot.DiscordSupervisor
}
protected async Task DiscordRebuildChannels()
{
if (DiscordServer != null)
{
List<string> required_cats = new List<string>() { "bot", "group", "im" };
IReadOnlyCollection<ICategoryChannel> found_cats = await DiscordServer.GetCategoriesAsync(CacheMode.AllowDownload);
@ -272,3 +274,4 @@ namespace BetterSecondBot.DiscordSupervisor
}
}
}
}

View file

@ -57,7 +57,6 @@ namespace BetterSecondBot.DiscordSupervisor
if (myconfig.DiscordFull_Enable == true)
{
_ = StartDiscordClientService();
login_bot(false);
keep_alive();
}
else
@ -67,11 +66,14 @@ namespace BetterSecondBot.DiscordSupervisor
}
protected override void login_bot(bool self_keep_alive)
{
if (controler != null)
{
controler = new CliExitOnLogout(myconfig, running_as_docker, self_keep_alive);
controler.Bot.setDiscordClient(DiscordClient);
attach_events();
}
}
}
}

View file

@ -28,6 +28,10 @@ namespace BetterSecondBot.DiscordSupervisor
DiscordServer = DiscordClient.GetGuild(myconfig.DiscordFull_ServerID);
if (DiscordServer != null)
{
if (myconfig.DiscordFull_Enable == true)
{
login_bot(false);
}
DiscordUnixTimeOnine = helpers.UnixTimeNow();
DiscordClientConnected = true;
await DiscordRebuildChannels();

View file

@ -39,6 +39,7 @@ namespace BetterSecondBot.DiscordSupervisor
return await MarkMessage(message, "❌");
}
controler.Bot.KillMePlease();
controler = null;
return await MarkMessage(message, "✅").ConfigureAwait(false);
}
else if(message.Content == "exit")

View file

@ -15,6 +15,7 @@ namespace BetterSecondBot.DiscordSupervisor
protected bool discord_group_relay;
protected DiscordSocketClient DiscordClient;
protected bool DiscordClientConnected;
protected IGuild DiscordServer;
protected string LastSendDiscordStatus = "";
protected long DiscordUnixTimeOnine;