mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
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));
|
|
}
|
|
}
|
|
}
|