Autorestart on token check fail
This commit is contained in:
@@ -46,6 +46,8 @@ public static class Entry
|
||||
|
||||
#endif
|
||||
|
||||
Console.Clear();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||
Console.WriteLine(logo);
|
||||
Console.ResetColor();
|
||||
|
||||
@@ -21,7 +21,6 @@ public class Program
|
||||
public static async Task Startup(string[] args)
|
||||
{
|
||||
await LoadComponents(args);
|
||||
|
||||
await PrepareConsole();
|
||||
await ConsoleInputHandler();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
@@ -106,8 +107,11 @@ public class Boot
|
||||
if (arg.Message.Contains("401"))
|
||||
{
|
||||
Application.CurrentApplication.ApplicationEnvironmentVariables.Remove("token");
|
||||
Application.CurrentApplication.Logger.Log("The token is invalid. Please restart the bot and follow the instructions", this, LogType.CRITICAL);
|
||||
Application.CurrentApplication.Logger.Log("The token is invalid.", this, LogType.CRITICAL);
|
||||
await Application.CurrentApplication.ApplicationEnvironmentVariables.SaveToFile();
|
||||
await Task.Delay(3000);
|
||||
|
||||
Process.Start(Environment.ProcessPath);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user