using System; using DiscordBotCore.Interfaces; using DiscordBotCore.Others; using DiscordBotCore.Others.Exceptions; namespace DiscordBotCore.Loaders; public class PluginLoaderResult { private Option4 _Result; public static PluginLoaderResult FromIDbCommand(IDbCommand command) => new PluginLoaderResult(new Option4(command)); public static PluginLoaderResult FromIDbEvent(IDbEvent dbEvent) => new PluginLoaderResult(new Option4(dbEvent)); public static PluginLoaderResult FromIDbSlashCommand(IDbSlashCommand slashCommand) => new PluginLoaderResult(new Option4(slashCommand)); public static PluginLoaderResult FromICommandAction(ICommandAction commandAction) => new PluginLoaderResult(new Option4(commandAction)); public static PluginLoaderResult FromException(Exception exception) => new PluginLoaderResult(new Option4(exception)); public static PluginLoaderResult FromException(string exception) => new PluginLoaderResult(new Option4(new Exception(message: exception))); private PluginLoaderResult(Option4 result) { _Result = result; } public void Match(Action commandAction, Action eventAction, Action slashCommandAction, Action commandActionAction, Action exceptionAction) { _Result.Match(commandAction, eventAction, slashCommandAction, commandActionAction, exceptionAction); } public TResult Match(Func commandFunc, Func eventFunc, Func slashCommandFunc, Func commandActionFunc, Func exceptionFunc) { return _Result.Match(commandFunc, eventFunc, slashCommandFunc, commandActionFunc, exceptionFunc); } }