mirror of
https://github.com/Jetsparrow/antiantiswearingbot.git
synced 2026-01-20 23:16:08 +03:00
24 lines
676 B
C#
24 lines
676 B
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
|
|
|
namespace AntiAntiSwearingBot;
|
|
public class StartupHealthCheck : IHealthCheck
|
|
{
|
|
Aasb Bot { get; }
|
|
|
|
public StartupHealthCheck(Aasb 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."));
|
|
}
|
|
} |