Moved items and reimplemented SettingsDictionary.cs

This commit is contained in:
2023-08-01 21:28:44 +03:00
parent 7107b17f19
commit b4f5e40f12
18 changed files with 268 additions and 273 deletions

View File

@@ -11,7 +11,7 @@ public class Clear : ICommandAction
public string Description => "Clears the console";
public string Usage => "clear";
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public Task Execute(string[] args)
{
Console.Clear();

View File

@@ -17,21 +17,21 @@ public class Exit : ICommandAction
{
if (args is null || args.Length == 0)
{
Config.Logger.Log("Exiting...", "Exit", isInternal:false);
await Config.Data.Save();
Config.Logger.Log("Exiting...", "Exit", isInternal: false);
await Config.AppSettings.SaveToFile();
await Config.Logger.SaveToFile();
Environment.Exit(0);
}
else
{
switch (args[0])
switch ( args[0] )
{
case "help":
Console.WriteLine("Usage : exit [help|force]");
Console.WriteLine("help : Displays this message");
Console.WriteLine("force | -f : Exits the bot without saving the config");
break;
case "-f":
case "force":
Config.Logger.Log("Exiting (FORCE)...", "Exit", LogLevel.WARNING, false);

View File

@@ -34,7 +34,8 @@ public class Help : ICommandAction
items.Add(new[] { "-", "-", "-" });
Utilities.Utilities.FormatAndAlignTable(items,
TableFormat.CENTER_EACH_COLUMN_BASED);
TableFormat.CENTER_EACH_COLUMN_BASED
);
return;
}
@@ -55,6 +56,7 @@ public class Help : ICommandAction
};
Utilities.Utilities.FormatAndAlignTable(actionData,
TableFormat.CENTER_EACH_COLUMN_BASED);
TableFormat.CENTER_EACH_COLUMN_BASED
);
}
}

View File

@@ -31,7 +31,7 @@ public class Plugin : ICommandAction
return;
}
switch (args[0])
switch ( args[0] )
{
case "list":
var manager =
@@ -75,7 +75,8 @@ public class Plugin : ICommandAction
Console.WriteLine("An error occured while loading: " + name);
else
Console.WriteLine("[CMD] Failed to load command : " + name + " because " +
exception!.Message);
exception!.Message
);
}
Console.ForegroundColor = cc;
@@ -113,7 +114,8 @@ public class Plugin : ICommandAction
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[SLASH] Failed to load command : " + name + " because " +
exception!.Message);
exception!.Message
);
}
Console.ForegroundColor = cc;
@@ -156,7 +158,7 @@ public class Plugin : ICommandAction
//download plugin progress bar for linux and windows terminals
var spinner = new Utilities.Utilities.Spinner();
spinner.Start();
IProgress<float> progress = new Progress<float>(p => { spinner.Message = $"Downloading {pluginName}... {Math.Round(p,2)}% " ; });
IProgress<float> progress = new Progress<float>(p => { spinner.Message = $"Downloading {pluginName}... {Math.Round(p, 2)}% "; });
await ServerCom.DownloadFileAsync(pluginLink, $"./Data/{pluginType}s/{pluginName}.dll", progress);
spinner.Stop();
Console.WriteLine();