diff --git a/DiscordBot/Entry.cs b/DiscordBot/Entry.cs
index cfb7d25..15be462 100644
--- a/DiscordBot/Entry.cs
+++ b/DiscordBot/Entry.cs
@@ -1,5 +1,7 @@
using System;
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Reflection;
@@ -7,6 +9,18 @@ namespace DiscordBot;
public static class Entry
{
+ ///
+ /// Some startup actions that can are executed when the console first starts. This actions are invoked externally at application launch
+ ///
+ private static readonly List StartupActions = [
+ new StartupAction("/purge_plugins", (args) => {
+ foreach (var plugin in Directory.GetFiles("./Data/Plugins", "*.dll", SearchOption.AllDirectories))
+ {
+ File.Delete(plugin);
+ }
+ })
+ ];
+
private static readonly string logo =
#if DEBUG
@"
@@ -36,12 +50,9 @@ public static class Entry
public static void Main(string[] args)
{
#if DEBUG
- if (args.Length == 1 && args[0] == "/purge_plugins" )
+ if (args.Length > 0)
{
- foreach (var plugin in Directory.GetFiles("./Data/Plugins", "*.dll", SearchOption.AllDirectories))
- {
- File.Delete(plugin);
- }
+ StartupActions.FirstOrDefault(action => action.Command == args[0], null)?.RunAction(args[..1]);
}
#endif
diff --git a/DiscordBot/IStartupAction.cs b/DiscordBot/IStartupAction.cs
new file mode 100644
index 0000000..637a5a1
--- /dev/null
+++ b/DiscordBot/IStartupAction.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace DiscordBot
+{
+ internal interface IStartupAction
+ {
+ string Command { get; init; }
+ Action RunAction { get; init; }
+ }
+}
\ No newline at end of file
diff --git a/DiscordBot/StartupAction.cs b/DiscordBot/StartupAction.cs
new file mode 100644
index 0000000..8e7a94a
--- /dev/null
+++ b/DiscordBot/StartupAction.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DiscordBot
+{
+ internal record StartupAction(string Command, Action RunAction) : IStartupAction;
+}