14 lines
455 B
C#
14 lines
455 B
C#
using Remora.Discord.Gateway.Results;
|
|
|
|
namespace Catalogger.Backend.Bot;
|
|
|
|
public class ShardedDiscordService(ShardedGatewayClient client, IHostApplicationLifetime lifetime)
|
|
: BackgroundService
|
|
{
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
var result = await client.RunAsync(stoppingToken);
|
|
if (result.Error is GatewayError { IsCritical: true })
|
|
lifetime.StopApplication();
|
|
}
|
|
}
|