mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
🚧 Core re-init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
public abstract class Module
|
||||
{
|
||||
protected readonly Core Core;
|
||||
protected IConfiguration Configuration => Core.Configuration;
|
||||
|
||||
public Module(Core core)
|
||||
{
|
||||
Core = core;
|
||||
}
|
||||
|
||||
public virtual void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures if module is loaded and started. Note that call can change module event chain.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The Module type.</typeparam>
|
||||
/// <returns>Module instance.</returns>
|
||||
protected T EnsureLoaded<T>() where T : Module
|
||||
{
|
||||
return (T) Core.EnsureLoaded(typeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user