1
0
mirror of https://github.com/oliverbooth/VPLink synced 2024-11-14 04:35:42 +00:00
VPLink/VpBridge/Program.cs

41 lines
1.3 KiB
C#
Raw Normal View History

using Discord;
using Discord.Interactions;
2023-08-22 14:57:18 +01:00
using Discord.WebSocket;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using Tomlyn.Extensions.Configuration;
using VpBridge.Services;
using VpSharp;
using X10D.Hosting.DependencyInjection;
Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.WriteTo.File("logs/latest.log", rollingInterval: RollingInterval.Day)
#if DEBUG
.MinimumLevel.Debug()
#endif
.CreateLogger();
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Configuration.AddTomlFile("data/config.toml", true, true);
builder.Logging.ClearProviders();
builder.Logging.AddSerilog();
builder.Services.AddSingleton<VirtualParadiseClient>();
builder.Services.AddSingleton<InteractionService>();
builder.Services.AddSingleton<DiscordSocketClient>();
builder.Services.AddSingleton(new DiscordSocketConfig
2023-08-22 14:57:18 +01:00
{
GatewayIntents = GatewayIntents.AllUnprivileged | GatewayIntents.MessageContent
});
2023-08-22 14:57:18 +01:00
builder.Services.AddHostedSingleton<IVirtualParadiseService, VirtualParadiseService>();
builder.Services.AddHostedSingleton<IDiscordService, DiscordService>();
builder.Services.AddHostedSingleton<RelayService>();
await builder.Build().RunAsync();