diff --git a/CollabVMSharp b/CollabVMSharp index 0440abd..7117823 160000 --- a/CollabVMSharp +++ b/CollabVMSharp @@ -1 +1 @@ -Subproject commit 0440abd027aeb35299ea05f275841a9ef012a6f4 +Subproject commit 7117823772a3615890dfc833bce81cc05be15426 diff --git a/EmperorPalpatine/IConfig.cs b/EmperorPalpatine/IConfig.cs index 58748f1..a89f1ab 100644 --- a/EmperorPalpatine/IConfig.cs +++ b/EmperorPalpatine/IConfig.cs @@ -31,7 +31,8 @@ public class ConfigVM public string Name { get; set; } public string URL { get; set; } public string Node { get; set; } - public string Password { get; set; } + public string? Password { get; set; } + public string? Token { get; set; } public ulong[]? DiscordMods { get; set; } } diff --git a/EmperorPalpatine/VM.cs b/EmperorPalpatine/VM.cs index 93dd698..858f5fa 100644 --- a/EmperorPalpatine/VM.cs +++ b/EmperorPalpatine/VM.cs @@ -21,6 +21,16 @@ public class VM public VM(string username, ConfigVM config, Database db) { this.Config = config; + if (this.Config.Password == null && this.Config.Token == null) + { + Utilities.Log(LogLevel.FATAL, $"VM {this.Config.Name} has no password or token set."); + Environment.Exit(1); + } + if (this.Config.Password != null && this.Config.Token != null) + { + Utilities.Log(LogLevel.FATAL, $"VM {this.Config.Name} has both a password and token set."); + Environment.Exit(1); + } this.username = username; this.database = db; retryTimer.Interval = 1000; @@ -91,7 +101,11 @@ public class VM retryTimer.Start(); return; } - await cvm.Login(Config.Password); + + if (this.Config.Password != null) + await cvm.Login(Config.Password); + else + await cvm.LoginAccount(Config.Token!); GotAuth.TrySetResult(null); }