using System; using System.Collections.Generic; using System.Threading.Tasks; using DiscordBot.Bot.Actions.Extra; using DiscordBotCore; using DiscordBotCore.Interfaces; using DiscordBotCore.Others; using DiscordBotCore.Others.Actions; namespace DiscordBot.Bot.Actions; public class Plugin: ICommandAction { private bool pluginsLoaded; public string ActionName => "plugin"; public string Description => "Manages plugins. Use plugin help for more info."; public string Usage => "plugin "; public IEnumerable ListOfOptions => new List { new InternalActionOption("help", "Displays this message"), new InternalActionOption("list", "Lists all plugins"), new InternalActionOption("load", "Loads all plugins"), new InternalActionOption("install", "Installs a plugin", [ new InternalActionOption("name", "The name of the plugin to install") ]), new InternalActionOption("refresh", "Refreshes the plugin list"), new InternalActionOption("uninstall", "Uninstalls a plugin"), new InternalActionOption("branch", "Sets a plugin option", [ new InternalActionOption("set", "Sets the branch"), new InternalActionOption("get", "Gets the branch") ]) }; public InternalActionRunType RunType => InternalActionRunType.ON_CALL; public async Task Execute(string[] args) { if (args is null || args.Length == 0 || args[0] == "help") { Console.WriteLine("Usage : plugin [help|list|load|install]"); Console.WriteLine("help : Displays this message"); Console.WriteLine("list : Lists all plugins"); Console.WriteLine("load : Loads all plugins"); Console.WriteLine("install : Installs a plugin"); Console.WriteLine("refresh : Refreshes the plugin list"); return; } switch (args[0]) { case "branch": if (args.Length < 2) { Console.WriteLine("Usage : plugin branch