-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatServiceCollectionExtensions.cs
More file actions
27 lines (23 loc) · 1.08 KB
/
Copy pathChatServiceCollectionExtensions.cs
File metadata and controls
27 lines (23 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Microsoft.Extensions.DependencyInjection;
using RustPlusBot.Features.Chat.Hosting;
using RustPlusBot.Features.Chat.Inbound;
using RustPlusBot.Features.Chat.Relaying;
using RustPlusBot.Features.Chat.Webhooks;
namespace RustPlusBot.Features.Chat;
/// <summary>DI registration for the team chat bridge.</summary>
public static class ChatServiceCollectionExtensions
{
/// <summary>Registers the dedup buffer, webhook poster, relay, inbound processor, and hosted service.</summary>
/// <param name="services">The service collection to add to.</param>
/// <returns>The same service collection, for chaining.</returns>
public static IServiceCollection AddChat(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
services.AddSingleton<RelayDedupBuffer>();
services.AddSingleton<ITeamChatWebhookPoster, DiscordTeamChatWebhookPoster>();
services.AddSingleton<TeamChatRelay>();
services.AddSingleton<TeamChatInboundProcessor>();
services.AddHostedService<ChatHostedService>();
return services;
}
}