Refactor repo structure

This commit is contained in:
Marco Realacci 2024-01-19 03:29:39 +01:00
parent 36ac339086
commit 8fc89fbc03
1732 changed files with 3812 additions and 67 deletions

View file

@ -0,0 +1,12 @@
using Telegram.Bot;
using Telegram.Bot.Types;
namespace HomeBot.ModuleLoader
{
public interface IModule
{
public string Cmd();
public string GetName();
public void ProcessUpdate(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken);
}
}

View file

@ -0,0 +1,18 @@
namespace HomeBot.ModuleLoader
{
public class ModuleLoader
{
public Dictionary<string, IModule> Modules { get; private set; }
public ModuleLoader()
{
Modules = new Dictionary<string, IModule>();
}
public void LoadModule(IModule module)
{
if (Modules == null) Modules = new Dictionary<string, IModule>();
Modules.Add(module.Cmd(), module);
}
}
}