More fixes to the new config. Module loader reworked

This commit is contained in:
2024-08-06 22:47:59 +03:00
parent 27e25a9166
commit 18a059af0e
51 changed files with 390 additions and 301 deletions

View File

@@ -3,7 +3,7 @@ using DiscordBotCore.Others;
namespace DiscordBotCore.Interfaces;
public interface DBCommand
public interface IDbCommand
{
/// <summary>
/// Command to be executed
@@ -30,7 +30,7 @@ public interface DBCommand
/// <summary>
/// true if the command requre admin, otherwise false
/// </summary>
bool requireAdmin { get; }
bool RequireAdmin { get; }
/// <summary>
/// The main body of the command. This is what is executed when user calls the command in Server
@@ -44,7 +44,7 @@ public interface DBCommand
/// The main body of the command. This is what is executed when user calls the command in DM
/// </summary>
/// <param name="args">The disocrd Context</param>
void ExecuteDM(DbCommandExecutingArguments args)
void ExecuteDm(DbCommandExecutingArguments args)
{
}
}

View File

@@ -2,7 +2,7 @@
namespace DiscordBotCore.Interfaces;
public interface DBEvent
public interface IDbEvent
{
/// <summary>
/// The name of the event

View File

@@ -6,11 +6,11 @@ using Discord.WebSocket;
namespace DiscordBotCore.Interfaces;
public interface DBSlashCommand
public interface IDbSlashCommand
{
string Name { get; }
string Description { get; }
bool canUseDM { get; }
bool CanUseDm { get; }
bool HasInteraction { get; }
List<SlashCommandOptionBuilder> Options { get; }
@@ -18,7 +18,7 @@ public interface DBSlashCommand
void ExecuteServer(SocketSlashCommand context)
{ }
void ExecuteDM(SocketSlashCommand context) { }
void ExecuteDm(SocketSlashCommand context) { }
Task ExecuteInteraction(SocketInteraction interaction) => Task.CompletedTask;
}

View File

@@ -1,15 +0,0 @@
using DiscordBotCore.Others;
using System;
namespace DiscordBotCore.Interfaces.Logger
{
public interface ILogMessage
{
public string Message { get; protected set; }
public DateTime ThrowTime { get; protected set; }
public string SenderName { get; protected set; }
public LogType LogMessageType { get; protected set; }
}
}

View File

@@ -1,26 +0,0 @@
using DiscordBotCore.Interfaces.Modules;
using DiscordBotCore.Others;
using System;
namespace DiscordBotCore.Interfaces.Logger
{
public interface ILogger : IBaseModule
{
public struct FormattedMessage {
public string Message;
public LogType Type;
}
string LogMessageFormat { get; set; }
void Log(string message);
void Log(string message, LogType logType);
void Log(string message, LogType logType, string format);
void Log(string message, object Sender);
void Log(string message, object Sender, LogType type);
void LogException(Exception exception, object Sender, bool logFullStack = false);
void SetOutFunction(Action<string> outFunction);
}
}

View File

@@ -1,8 +0,0 @@
using System;
namespace DiscordBotCore.Interfaces.Modules
{
public interface IBaseModule
{
}
}

View File

@@ -2,10 +2,20 @@
namespace DiscordBotCore.Interfaces.Modules
{
public interface IModule<T> where T : IBaseModule
public enum ModuleType
{
Logger,
Other
}
/// <summary>
/// Define a module.
/// </summary>
public interface IModule
{
public ModuleType ModuleType { get; }
public string Name { get; }
public T Module { get; }
public Task Initialize();
}
}

View File

@@ -9,7 +9,6 @@ namespace DiscordBotCore.Interfaces.PluginManager
{
public string BaseUrl { get; set; }
public string Branch { get; set; }
Task AppendPluginToDatabase(PluginInfo pluginData);
Task CheckForUpdates();
Task ExecutePluginInstallScripts(List<OnlineScriptDependencyInfo> listOfDependencies);
@@ -24,7 +23,6 @@ namespace DiscordBotCore.Interfaces.PluginManager
Task<bool> MarkPluginToUninstall(string pluginName);
Task RemovePluginFromDatabase(string pluginName);
Task UninstallMarkedPlugins();
Task SetEnabledStatus(string pluginName, bool status);
}
}