Merged projects with plugins and modules

This commit is contained in:
2024-07-22 01:18:00 +03:00
parent 1fd065f4c2
commit 8ace51c840
59 changed files with 1669 additions and 73 deletions

View File

@@ -23,7 +23,7 @@ namespace DiscordBot.Bot.Actions
new InternalActionOption("fileName", "The file name")
];
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public async Task Execute(string[] args)
{

View File

@@ -15,7 +15,7 @@ public class Clear: ICommandAction
public string Usage => "clear";
public IEnumerable<InternalActionOption> ListOfOptions => [];
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public Task Execute(string[] args)
{

View File

@@ -18,13 +18,13 @@ public class Exit: ICommandAction
new InternalActionOption("help", "Displays this message"),
new InternalActionOption("force | -f", "Exits the bot without saving the config")
};
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public async Task Execute(string[] args)
{
if (args is null || args.Length == 0)
{
Application.CurrentApplication.Logger.Log("Exiting...", this, LogType.WARNING);
Application.CurrentApplication.Logger.Log("Exiting...", this, LogType.Warning);
await Application.CurrentApplication.ApplicationEnvironmentVariables.SaveToFile();
Environment.Exit(0);
}
@@ -40,7 +40,7 @@ public class Exit: ICommandAction
case "-f":
case "force":
Application.CurrentApplication.Logger.Log("Exiting (FORCE)...", this, LogType.WARNING);
Application.CurrentApplication.Logger.Log("Exiting (FORCE)...", this, LogType.Warning);
Environment.Exit(0);
break;

View File

@@ -227,13 +227,13 @@ internal static class PluginMethods
{
if (data.IsSuccess)
{
Application.CurrentApplication.Logger.Log("Successfully loaded command : " + data.PluginName, LogType.INFO, "\t\t > {Message}");
Application.CurrentApplication.Logger.Log("Successfully loaded command : " + data.PluginName, LogType.Info, "\t\t > {Message}");
}
else
{
Application.CurrentApplication.Logger.Log("Failed to load command : " + data.PluginName + " because " + data.ErrorMessage,
typeof(PluginMethods), LogType.ERROR
typeof(PluginMethods), LogType.Error
);
}
@@ -243,12 +243,12 @@ internal static class PluginMethods
{
if (data.IsSuccess)
{
Application.CurrentApplication.Logger.Log("Successfully loaded event : " + data.PluginName, LogType.INFO, "\t\t > {Message}");
Application.CurrentApplication.Logger.Log("Successfully loaded event : " + data.PluginName, LogType.Info, "\t\t > {Message}");
}
else
{
Application.CurrentApplication.Logger.Log("Failed to load event : " + data.PluginName + " because " + data.ErrorMessage,
typeof(PluginMethods), LogType.ERROR
typeof(PluginMethods), LogType.Error
);
}
@@ -259,12 +259,12 @@ internal static class PluginMethods
{
if (data.IsSuccess)
{
Application.CurrentApplication.Logger.Log("Successfully loaded slash command : " + data.PluginName, LogType.INFO, "\t\t > {Message}");
Application.CurrentApplication.Logger.Log("Successfully loaded slash command : " + data.PluginName, LogType.Info, "\t\t > {Message}");
}
else
{
Application.CurrentApplication.Logger.Log("Failed to load slash command : " + data.PluginName + " because " + data.ErrorMessage,
typeof(PluginMethods), LogType.ERROR
typeof(PluginMethods), LogType.Error
);
}
@@ -275,12 +275,12 @@ internal static class PluginMethods
{
if (data.IsSuccess)
{
Application.CurrentApplication.Logger.Log("Successfully loaded action : " + data.PluginName, LogType.INFO, "\t\t > {Message}");
Application.CurrentApplication.Logger.Log("Successfully loaded action : " + data.PluginName, LogType.Info, "\t\t > {Message}");
}
else
{
Application.CurrentApplication.Logger.Log("Failed to load action : " + data.PluginName + " because " + data.ErrorMessage,
typeof(PluginMethods), LogType.ERROR
typeof(PluginMethods), LogType.Error
);
}

View File

@@ -25,7 +25,7 @@ public class Help: ICommandAction
new InternalActionOption("command", "The command to get help for")
];
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public async Task Execute(string[] args)
{

View File

@@ -18,7 +18,7 @@ namespace DiscordBot.Bot.Actions
public IEnumerable<InternalActionOption> ListOfOptions => [];
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public Task Execute(string[] args)
{

View File

@@ -38,7 +38,7 @@ public class Plugin: ICommandAction
])
};
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public async Task Execute(string[] args)
{
@@ -126,13 +126,13 @@ public class Plugin: ICommandAction
case "load":
if (pluginsLoaded)
{
Application.CurrentApplication.Logger.Log("Plugins already loaded", this, LogType.WARNING);
Application.CurrentApplication.Logger.Log("Plugins already loaded", this, LogType.Warning);
break;
}
if (Application.CurrentApplication.DiscordBotClient is null)
{
Application.CurrentApplication.Logger.Log("DiscordBot is null", this, LogType.WARNING);
Application.CurrentApplication.Logger.Log("DiscordBot is null", this, LogType.Warning);
break;
}

View File

@@ -21,7 +21,7 @@ public class SettingsConfig: ICommandAction
new InternalActionOption("remove", "Remove a setting"),
new InternalActionOption("add", "Add a setting")
};
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public Task Execute(string[] args)
{
if (args is null)