Cleaned up after removal of old commands
This commit is contained in:
@@ -1,49 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
namespace DiscordBot.Discord.Actions
|
|
||||||
{
|
|
||||||
public class ListPlugins : ICommandAction
|
|
||||||
{
|
|
||||||
public string ActionName => "listplugs";
|
|
||||||
|
|
||||||
public string Description => "Lists all plugins";
|
|
||||||
|
|
||||||
public string Usage => "listplugs";
|
|
||||||
|
|
||||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
|
||||||
|
|
||||||
public async Task Execute(string[] args)
|
|
||||||
{
|
|
||||||
|
|
||||||
var manager = new PluginManager.Online.PluginsManager(Program.URLs["PluginList"], Program.URLs["PluginVersions"]);
|
|
||||||
if (manager == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Plugin manager is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var data = await manager.GetAvailablePlugins();
|
|
||||||
var items = new List<string[]>
|
|
||||||
{
|
|
||||||
new[] { "-", "-", "-", "-" },
|
|
||||||
new[] { "Name", "Type", "Description", "Required" },
|
|
||||||
new[] { "-", "-", "-", "-" }
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var plugin in data)
|
|
||||||
{
|
|
||||||
items.Add(new[] { plugin[0], plugin[1], plugin[2], plugin[3] });
|
|
||||||
}
|
|
||||||
|
|
||||||
items.Add(new[] { "-", "-", "-", "-" });
|
|
||||||
|
|
||||||
DiscordBot.Utilities.Utilities.FormatAndAlignTable(items, Utilities.TableFormat.DEFAULT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using PluginManager.Loaders;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
namespace DiscordBot.Discord.Actions
|
|
||||||
{
|
|
||||||
public class LoadPlugins : ICommandAction
|
|
||||||
{
|
|
||||||
public string ActionName => "loadplugs";
|
|
||||||
|
|
||||||
public string Description => "Loads all plugins";
|
|
||||||
|
|
||||||
public string Usage => "loadplugs";
|
|
||||||
|
|
||||||
private bool pluginsLoaded = false;
|
|
||||||
|
|
||||||
public InternalActionRunType RunType => InternalActionRunType.ON_STARTUP;
|
|
||||||
|
|
||||||
public async Task Execute(string[] args)
|
|
||||||
{
|
|
||||||
if (pluginsLoaded)
|
|
||||||
return;
|
|
||||||
var loader = new PluginLoader(PluginManager.Config.DiscordBot.client);
|
|
||||||
var cc = Console.ForegroundColor;
|
|
||||||
loader.onCMDLoad += (name, typeName, success, exception) =>
|
|
||||||
{
|
|
||||||
if (name == null || name.Length < 2)
|
|
||||||
name = typeName;
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.WriteLine("[CMD] Successfully loaded command : " + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
if (exception is null)
|
|
||||||
Console.WriteLine("An error occured while loading: " + name);
|
|
||||||
else
|
|
||||||
Console.WriteLine("[CMD] Failed to load command : " + name + " because " + exception!.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.ForegroundColor = cc;
|
|
||||||
};
|
|
||||||
loader.onEVELoad += (name, typeName, success, exception) =>
|
|
||||||
{
|
|
||||||
if (name == null || name.Length < 2)
|
|
||||||
name = typeName;
|
|
||||||
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.WriteLine("[EVENT] Successfully loaded event : " + name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
Console.WriteLine("[EVENT] Failed to load event : " + name + " because " + exception!.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.ForegroundColor = cc;
|
|
||||||
};
|
|
||||||
|
|
||||||
loader.onSLSHLoad += (name, typeName, success, exception) =>
|
|
||||||
{
|
|
||||||
if (name == null || name.Length < 2)
|
|
||||||
name = typeName;
|
|
||||||
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.WriteLine("[SLASH] Successfully loaded command : " + name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
Console.WriteLine("[SLASH] Failed to load command : " + name + " because " + exception!.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.ForegroundColor = cc;
|
|
||||||
};
|
|
||||||
|
|
||||||
loader.LoadPlugins();
|
|
||||||
Console.ForegroundColor = cc;
|
|
||||||
pluginsLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -51,7 +51,7 @@ public class Plugin : ICommandAction
|
|||||||
|
|
||||||
items.Add(new[] { "-", "-", "-", "-" });
|
items.Add(new[] { "-", "-", "-", "-" });
|
||||||
|
|
||||||
DiscordBot.Utilities.Utilities.FormatAndAlignTable(items, Utilities.TableFormat.DEFAULT);
|
Utilities.Utilities.FormatAndAlignTable(items, Utilities.TableFormat.DEFAULT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,4 @@ namespace DiscordBot.Utilities
|
|||||||
CENTER_OVERALL_LENGTH,
|
CENTER_OVERALL_LENGTH,
|
||||||
DEFAULT
|
DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ProgressBarType
|
|
||||||
{
|
|
||||||
NORMAL,
|
|
||||||
NO_END
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user