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 "; public IEnumerable 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); } } } }