mirror of
https://github.com/appinfosapienza/so-un-bot.git
synced 2025-05-05 23:52:35 +02:00
Refactor repo structure
This commit is contained in:
parent
36ac339086
commit
8fc89fbc03
1732 changed files with 3812 additions and 67 deletions
12
Bot/ModuleLoader/IModule.cs
Normal file
12
Bot/ModuleLoader/IModule.cs
Normal 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);
|
||||
}
|
||||
}
|
18
Bot/ModuleLoader/ModuleLoader.cs
Normal file
18
Bot/ModuleLoader/ModuleLoader.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue