Removed the WebUI. Removed the Modules

This commit is contained in:
2024-10-30 23:10:04 +02:00
parent f8df0f0254
commit 9e8bfbbe16
2133 changed files with 120 additions and 15581 deletions

View File

@@ -35,7 +35,7 @@ namespace DiscordBot.Bot.Actions
{
if(args.Length < 1)
{
Console.WriteLine("Incorrect number of arguments !");
Application.CurrentApplication.Logger.Log("Incorrect number of arguments !", LogType.Warning);
return;
}
@@ -44,12 +44,17 @@ namespace DiscordBot.Bot.Actions
if(!File.Exists(path))
{
Console.WriteLine("The file does not exist !!");
Application.CurrentApplication.Logger.Log("The file does not exist !!", LogType.Error);
return;
}
if (args[^1] is null)
{
Application.CurrentApplication.Logger.Log("The plugin name is invalid", LogType.Error);
}
PluginInfo pluginInfo = new PluginInfo(args[^1], new(1, 0, 0), [], false, true, args.Contains("-enabled"));
Application.Logger.Log("Adding plugin: " + args[^1]);
Application.CurrentApplication.Logger.Log("Adding plugin: " + args[^1]);
await Application.CurrentApplication.PluginManager.AppendPluginToDatabase(pluginInfo);
}
}

View File

@@ -26,7 +26,7 @@ public class Exit: ICommandAction
{
if (args is null || args.Length == 0)
{
Application.Logger.Log("Exiting...", this, LogType.Warning);
Application.CurrentApplication.Logger.Log("Exiting...", this, LogType.Warning);
await Application.CurrentApplication.ApplicationEnvironmentVariables.SaveToFile();
Environment.Exit(0);
}
@@ -42,7 +42,7 @@ public class Exit: ICommandAction
case "-f":
case "force":
Application.Logger.Log("Exiting (FORCE)...", this, LogType.Warning);
Application.CurrentApplication.Logger.Log("Exiting (FORCE)...", this, LogType.Warning);
Environment.Exit(0);
break;

View File

@@ -82,7 +82,7 @@ internal static class PluginMethods
}catch(Exception ex)
{
Application.Logger.LogException(ex, typeof(PluginMethods), false);
Application.CurrentApplication.Logger.LogException(ex, typeof(PluginMethods), false);
} finally
{
await Application.CurrentApplication.InternalActionManager.Initialize();
@@ -219,22 +219,22 @@ internal static class PluginMethods
loader.OnCommandLoaded += (command) =>
{
Application.Logger.Log($"Command {command.Command} loaded successfully", LogType.Info);
Application.CurrentApplication.Logger.Log($"Command {command.Command} loaded successfully", LogType.Info);
};
loader.OnEventLoaded += (eEvent) =>
{
Application.Logger.Log($"Event {eEvent.Name} loaded successfully",LogType.Info);
Application.CurrentApplication.Logger.Log($"Event {eEvent.Name} loaded successfully",LogType.Info);
};
loader.OnActionLoaded += (action) =>
{
Application.Logger.Log($"Action {action.ActionName} loaded successfully", LogType.Info);
Application.CurrentApplication.Logger.Log($"Action {action.ActionName} loaded successfully", LogType.Info);
};
loader.OnSlashCommandLoaded += (slashCommand) =>
{
Application.Logger.Log($"Slash Command {slashCommand.Name} loaded successfully", LogType.Info);
Application.CurrentApplication.Logger.Log($"Slash Command {slashCommand.Name} loaded successfully", LogType.Info);
};
await loader.LoadPlugins();

View File

@@ -1,50 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using DiscordBotCore;
using DiscordBotCore.Interfaces;
using DiscordBotCore.Others;
using DiscordBotCore.Others.Actions;
namespace DiscordBot.Bot.Actions
{
internal class Module : ICommandAction
{
public string ActionName => "module";
public string Description => "Access module commands";
public string Usage => "module <command>";
public IEnumerable<InternalActionOption> ListOfOptions => [
new InternalActionOption("list", "List all loaded modules")
];
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public Task Execute(string[] args)
{
string command = args?[0];
switch(command)
{
case "list":
ListLoadedModules();
break;
default:
return Task.CompletedTask;
}
return Task.CompletedTask;
}
private void ListLoadedModules()
{
var modules = Application.CurrentApplication.ModuleManager.GetLocalModules();
foreach (var module in modules)
{
Application.Logger.Log("Module: " + module.ModuleName, this, LogType.Info);
}
}
}
}

View File

@@ -96,7 +96,7 @@ public class Plugin: ICommandAction
case "load":
if (pluginsLoaded)
{
Application.Logger.Log("Plugins already loaded", this, LogType.Warning);
Application.CurrentApplication.Logger.Log("Plugins already loaded", this, LogType.Warning);
break;
}