mirror of
https://github.com/Jetsparrow/antiantiswearingbot.git
synced 2026-01-21 07:16:08 +03:00
23 lines
687 B
C#
23 lines
687 B
C#
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
|
|
|
using Jetsparrow.Aasb.Services;
|
|
|
|
namespace Jetsparrow.Aasb.Health;
|
|
public class StartupHealthCheck : IHealthCheck
|
|
{
|
|
AntiAntiSwearingBot Bot { get; }
|
|
|
|
public StartupHealthCheck(AntiAntiSwearingBot bot)
|
|
{
|
|
Bot = bot;
|
|
}
|
|
|
|
public Task<HealthCheckResult> CheckHealthAsync(
|
|
HealthCheckContext context, CancellationToken cancellationToken = default)
|
|
{
|
|
if (Bot.Started)
|
|
return Task.FromResult(HealthCheckResult.Healthy("The startup task has completed."));
|
|
else
|
|
return Task.FromResult(HealthCheckResult.Unhealthy("That startup task is still running."));
|
|
}
|
|
} |