discord-v status fixs
This commit is contained in:
parent
3f85d1bae8
commit
108578656b
5 changed files with 64 additions and 53 deletions
|
|
@ -209,6 +209,8 @@ namespace BetterSecondBot.DiscordSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task DiscordRebuildChannels()
|
protected async Task DiscordRebuildChannels()
|
||||||
|
{
|
||||||
|
if (DiscordServer != null)
|
||||||
{
|
{
|
||||||
List<string> required_cats = new List<string>() { "bot", "group", "im" };
|
List<string> required_cats = new List<string>() { "bot", "group", "im" };
|
||||||
IReadOnlyCollection<ICategoryChannel> found_cats = await DiscordServer.GetCategoriesAsync(CacheMode.AllowDownload);
|
IReadOnlyCollection<ICategoryChannel> found_cats = await DiscordServer.GetCategoriesAsync(CacheMode.AllowDownload);
|
||||||
|
|
@ -272,3 +274,4 @@ namespace BetterSecondBot.DiscordSupervisor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ namespace BetterSecondBot.DiscordSupervisor
|
||||||
if (myconfig.DiscordFull_Enable == true)
|
if (myconfig.DiscordFull_Enable == true)
|
||||||
{
|
{
|
||||||
_ = StartDiscordClientService();
|
_ = StartDiscordClientService();
|
||||||
login_bot(false);
|
|
||||||
keep_alive();
|
keep_alive();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -67,11 +66,14 @@ namespace BetterSecondBot.DiscordSupervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void login_bot(bool self_keep_alive)
|
protected override void login_bot(bool self_keep_alive)
|
||||||
|
{
|
||||||
|
if (controler != null)
|
||||||
{
|
{
|
||||||
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);
|
||||||
attach_events();
|
attach_events();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,10 @@ namespace BetterSecondBot.DiscordSupervisor
|
||||||
DiscordServer = DiscordClient.GetGuild(myconfig.DiscordFull_ServerID);
|
DiscordServer = DiscordClient.GetGuild(myconfig.DiscordFull_ServerID);
|
||||||
if (DiscordServer != null)
|
if (DiscordServer != null)
|
||||||
{
|
{
|
||||||
|
if (myconfig.DiscordFull_Enable == true)
|
||||||
|
{
|
||||||
|
login_bot(false);
|
||||||
|
}
|
||||||
DiscordUnixTimeOnine = helpers.UnixTimeNow();
|
DiscordUnixTimeOnine = helpers.UnixTimeNow();
|
||||||
DiscordClientConnected = true;
|
DiscordClientConnected = true;
|
||||||
await DiscordRebuildChannels();
|
await DiscordRebuildChannels();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ namespace BetterSecondBot.DiscordSupervisor
|
||||||
return await MarkMessage(message, "❌");
|
return await MarkMessage(message, "❌");
|
||||||
}
|
}
|
||||||
controler.Bot.KillMePlease();
|
controler.Bot.KillMePlease();
|
||||||
|
controler = null;
|
||||||
return await MarkMessage(message, "✅").ConfigureAwait(false);
|
return await MarkMessage(message, "✅").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else if(message.Content == "exit")
|
else if(message.Content == "exit")
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ namespace BetterSecondBot.DiscordSupervisor
|
||||||
protected bool discord_group_relay;
|
protected bool discord_group_relay;
|
||||||
protected DiscordSocketClient DiscordClient;
|
protected DiscordSocketClient DiscordClient;
|
||||||
protected bool DiscordClientConnected;
|
protected bool DiscordClientConnected;
|
||||||
|
|
||||||
protected IGuild DiscordServer;
|
protected IGuild DiscordServer;
|
||||||
protected string LastSendDiscordStatus = "";
|
protected string LastSendDiscordStatus = "";
|
||||||
protected long DiscordUnixTimeOnine;
|
protected long DiscordUnixTimeOnine;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue