Files
Telegrator/src/Telegrator.Hosting/Hosting/HostedTelegramBotInfo.cs
T

30 lines
1.0 KiB
C#
Raw Normal View History

using Microsoft.Extensions.Configuration;
using Telegram.Bot;
using Telegram.Bot.Types;
2026-03-06 23:19:24 +04:00
using Telegrator.Core;
2026-03-09 13:23:21 +04:00
namespace Telegrator.Hosting;
/// <summary>
/// Implementation of <see cref="ITelegramBotInfo"/> that provides bot information.
/// Contains metadata about the Telegram bot including user details and service provider for wider filterring abilities
/// </summary>
/// <param name="client"></param>
/// <param name="services"></param>
/// <param name="configuration"></param>
public class HostedTelegramBotInfo(ITelegramBotClient client, IServiceProvider services, IConfiguration configuration) : ITelegramBotInfo
{
2026-03-09 13:23:21 +04:00
/// <inheritdoc/>
public User User { get; } = client.GetMe().Result;
2025-08-01 15:11:05 +04:00
/// <summary>
2026-03-09 13:23:21 +04:00
/// Provides access to services of this Hosted telegram bot
2025-08-01 15:11:05 +04:00
/// </summary>
2026-03-09 13:23:21 +04:00
public IServiceProvider Services { get; } = services;
2026-03-09 13:23:21 +04:00
/// <summary>
/// Provides access to configuration of this Hosted telegram bot
/// </summary>
public IConfiguration Configuration { get; } = configuration;
}