Updated Module engine
This commit is contained in:
13
DiscordBotCore/Others/Exceptions/ModuleMethodNotFound.cs
Normal file
13
DiscordBotCore/Others/Exceptions/ModuleMethodNotFound.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using DiscordBotCore.Interfaces.Modules;
|
||||
|
||||
namespace DiscordBotCore.Others.Exceptions;
|
||||
|
||||
public class ModuleMethodNotFound : Exception
|
||||
{
|
||||
private IModule _SearchedModule;
|
||||
public ModuleMethodNotFound(IModule module, string methodName) : base($"Method not found {methodName} in module {module.Name}")
|
||||
{
|
||||
_SearchedModule = module;
|
||||
}
|
||||
}
|
||||
15
DiscordBotCore/Others/Exceptions/ModuleNotFound.cs
Normal file
15
DiscordBotCore/Others/Exceptions/ModuleNotFound.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using DiscordBotCore.Interfaces.Modules;
|
||||
|
||||
namespace DiscordBotCore.Others.Exceptions;
|
||||
|
||||
public class ModuleNotFound : Exception
|
||||
{
|
||||
public ModuleNotFound(string moduleName) : base($"Module not found: {moduleName}")
|
||||
{
|
||||
}
|
||||
|
||||
public ModuleNotFound(ModuleType moduleType) : base($"No module with type {moduleType} found")
|
||||
{
|
||||
}
|
||||
}
|
||||
23
DiscordBotCore/Others/Exceptions/RequireInstallModule.cs
Normal file
23
DiscordBotCore/Others/Exceptions/RequireInstallModule.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using DiscordBotCore.Interfaces.Modules;
|
||||
using DiscordBotCore.Modules;
|
||||
|
||||
namespace DiscordBotCore.Others.Exceptions;
|
||||
|
||||
public class RequireInstallModule
|
||||
{
|
||||
private List<ModuleType> RequiredModulesWithType { get; }
|
||||
|
||||
public RequireInstallModule()
|
||||
{
|
||||
RequiredModulesWithType = new List<ModuleType>();
|
||||
}
|
||||
|
||||
public void AddType (ModuleType moduleType)
|
||||
{
|
||||
RequiredModulesWithType.Add(moduleType);
|
||||
}
|
||||
|
||||
public bool RequireAny => RequiredModulesWithType.Count > 0;
|
||||
public IList<ModuleType> RequiredModules => RequiredModulesWithType;
|
||||
}
|
||||
Reference in New Issue
Block a user