a5bfe7da24
* Added XML summaries to new members * Added TrySetInstance to HandlerDescriptor. Exception-free version of SetInstance method * Changed singleton ionstance setting in HandlersProvidedr
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Telegram.Bot;
|
|
using Telegram.Bot.Types;
|
|
using Telegrator.Configuration;
|
|
|
|
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, IConfigurationManager configuration) : ITelegramBotInfo
|
|
{
|
|
/// <inheritdoc/>
|
|
public User User { get; } = client.GetMe().Result;
|
|
|
|
/// <summary>
|
|
/// Provides access to services of this Hosted telegram bot
|
|
/// </summary>
|
|
public IServiceProvider Services { get; } = services;
|
|
|
|
/// <summary>
|
|
/// Provides access to configuration of this Hosted telegram bot
|
|
/// </summary>
|
|
public IConfigurationManager Configuration { get; } = configuration;
|
|
}
|
|
}
|