From 9717591224cec828ffd9116fe4d93d305dad1246 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 16 May 2024 11:54:31 +0200 Subject: [PATCH] Updates bot config to use ids instead of names --- Framework/ArgsUniform/ArgsUniform.cs | 8 +++----- Tools/BiblioTech/Configuration.cs | 20 ++++++++++---------- Tools/BiblioTech/Program.cs | 2 ++ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Framework/ArgsUniform/ArgsUniform.cs b/Framework/ArgsUniform/ArgsUniform.cs index d987aa7..e8f0277 100644 --- a/Framework/ArgsUniform/ArgsUniform.cs +++ b/Framework/ArgsUniform/ArgsUniform.cs @@ -42,7 +42,7 @@ namespace ArgsUniform { printAppInfo(); PrintHelp(); - throw new Exception(); + Environment.Exit(0); } var result = Activator.CreateInstance(); @@ -55,9 +55,7 @@ namespace ArgsUniform { if (!UniformAssign(result, attr, uniformProperty) && attr.Required) { - { - missingRequired.Add(uniformProperty); - } + missingRequired.Add(uniformProperty); } } } @@ -75,7 +73,7 @@ namespace ArgsUniform } PrintHelp(); - throw new ArgumentException("Unable to assemble all required arguments"); + Environment.Exit(1); } if (printResult) diff --git a/Tools/BiblioTech/Configuration.cs b/Tools/BiblioTech/Configuration.cs index 37e1cc3..73e143e 100644 --- a/Tools/BiblioTech/Configuration.cs +++ b/Tools/BiblioTech/Configuration.cs @@ -7,23 +7,23 @@ namespace BiblioTech [Uniform("token", "t", "TOKEN", true, "Discord Application Token")] public string ApplicationToken { get; set; } = string.Empty; - [Uniform("server-name", "sn", "SERVERNAME", true, "Name of the Discord server")] - public string ServerName { get; set; } = string.Empty; + [Uniform("server-id", "sn", "SERVERID", true, "ID of the Discord server")] + public ulong ServerId { get; set; } [Uniform("datapath", "dp", "DATAPATH", false, "Root path where all data files will be saved.")] public string DataPath { get; set; } = "datapath"; - [Uniform("admin-role", "a", "ADMINROLE", true, "Name of the Discord server admin role")] - public string AdminRoleName { get; set; } = string.Empty; + [Uniform("admin-role-id", "a", "ADMINROLEID", true, "ID of the Discord server admin role")] + public ulong AdminRoleId { get; set; } - [Uniform("admin-channel-name", "ac", "ADMINCHANNELNAME", true, "Name of the Discord server channel where admin commands are allowed.")] - public string AdminChannelName { get; set; } = "admin-channel"; + [Uniform("admin-channel-id", "ac", "ADMINCHANNELID", true, "ID of the Discord server channel where admin commands are allowed.")] + public ulong AdminChannelId{ get; set; } - [Uniform("rewards-channel-name", "rc", "REWARDSCHANNELNAME", false, "Name of the Discord server channel where participation rewards will be announced.")] - public string RewardsChannelName { get; set; } = ""; + [Uniform("rewards-channel-id", "rc", "REWARDSCHANNELID", false, "ID of the Discord server channel where participation rewards will be announced.")] + public ulong RewardsChannelId { get; set; } - [Uniform("chain-events-channel-name", "cc", "CHAINEVENTSCHANNELNAME", false, "Name of the Discord server channel where chain events will be posted.")] - public string ChainEventsChannelName { get; set; } = ""; + [Uniform("chain-events-channel-id", "cc", "CHAINEVENTSCHANNELID", false, "ID of the Discord server channel where chain events will be posted.")] + public ulong ChainEventsChannelID { get; set; } [Uniform("reward-api-port", "rp", "REWARDAPIPORT", false, "TCP listen port for the reward API.")] public int RewardApiPort { get; set; } = 31080; diff --git a/Tools/BiblioTech/Program.cs b/Tools/BiblioTech/Program.cs index a604812..f289d9b 100644 --- a/Tools/BiblioTech/Program.cs +++ b/Tools/BiblioTech/Program.cs @@ -21,6 +21,8 @@ namespace BiblioTech public static Task Main(string[] args) { + Log = new ConsoleLog(); + var uniformArgs = new ArgsUniform(PrintHelp, args); Config = uniformArgs.Parse();