Updated bootstrap and merged gitlab project

This commit is contained in:
2024-09-17 15:30:08 +03:00
parent a584423939
commit be75ef03cb
2097 changed files with 14141 additions and 148 deletions

View File

@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DiscordBotCore;
using DiscordBotCore.Others;
using Spectre.Console;
namespace DiscordBot;
@@ -42,8 +44,25 @@ public static class Installer
if (!Application.CurrentApplication.ApplicationEnvironmentVariables.ContainsKey("ServerID"))
{
var response = AskForConfig("ServerID", "Please enter the server Ids where the bot will be used (separated by ;):");
Application.CurrentApplication.ApplicationEnvironmentVariables.Add("ServerID", response);
var response = AskForConfig("ServerID", "Please enter the server Ids where the bot will be used (separated by ;):");
List<ulong> serverIds = new List<ulong>();
foreach (var id in response.Split(';'))
{
if(!ulong.TryParse(id, out ulong sID))
{
Application.Logger.Log($"Invalid server ID {id}", LogType.Warning);
}
serverIds.Add(sID);
}
if(!serverIds.Any())
{
Application.Logger.Log($"No valid server id provided", LogType.Critical);
Environment.Exit(-20);
}
Application.CurrentApplication.ApplicationEnvironmentVariables.Add("ServerID", serverIds);
}
await Application.CurrentApplication.ApplicationEnvironmentVariables.SaveToFile();