< Summary

Information
Class: TeleFlow.Telegram.Webhooks.Internal.TelegramBotIdentityStartupService
Assembly: TeleFlow.Framework.Webhooks
File(s): /_/src/TeleFlow.Framework.Webhooks/Internal/TelegramBotIdentityStartupService.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 43
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
StartingAsync(...)100%210%
StartAsync(...)100%210%
StartedAsync(...)100%210%
StoppingAsync(...)100%210%
StopAsync(...)100%210%
StoppedAsync(...)100%210%

File(s)

/_/src/TeleFlow.Framework.Webhooks/Internal/TelegramBotIdentityStartupService.cs

#LineLine coverage
 1using Microsoft.Extensions.Hosting;
 2using TeleFlow.Telegram.Internal;
 3
 4namespace TeleFlow.Telegram.Webhooks.Internal;
 5
 6/// <summary>
 7/// Resolves the current bot identity before the ASP.NET Core host starts accepting Telegram webhook updates,
 8/// allowing command routing to reject mentions addressed to another bot without network access per update.
 9/// </summary>
 10internal sealed class TelegramBotIdentityStartupService(
 11    ITelegramClient bot,
 12    TelegramBotIdentity botIdentity) : IHostedLifecycleService
 13{
 14    public Task StartingAsync(CancellationToken cancellationToken)
 15    {
 016        return botIdentity.EnsureResolvedAsync(bot, cancellationToken);
 17    }
 18
 19    public Task StartAsync(CancellationToken cancellationToken)
 20    {
 021        return Task.CompletedTask;
 22    }
 23
 24    public Task StartedAsync(CancellationToken cancellationToken)
 25    {
 026        return Task.CompletedTask;
 27    }
 28
 29    public Task StoppingAsync(CancellationToken cancellationToken)
 30    {
 031        return Task.CompletedTask;
 32    }
 33
 34    public Task StopAsync(CancellationToken cancellationToken)
 35    {
 036        return Task.CompletedTask;
 37    }
 38
 39    public Task StoppedAsync(CancellationToken cancellationToken)
 40    {
 041        return Task.CompletedTask;
 42    }
 43}