using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using NetCord.Hosting.Gateway; using NetCord.Hosting.Services; using NetCord.Hosting.Services.ApplicationCommands; using NetCord.Hosting.Services.ComponentInteractions; using NetCord.Services.ComponentInteractions; namespace FluxPose.DiscordBot; internal static class Program { public static void Main(string[] args) { var builder = Host.CreateApplicationBuilder(args); builder.Services .AddDiscordGateway(options => { options.Intents = GatewayIntents.Guilds | GatewayIntents.GuildUsers | GatewayIntents.GuildEmojisAndStickers; }) .AddApplicationCommands() .AddComponentInteractions(); AddActions(builder.Services); var host = builder.Build(); var configuration = host.Services.GetRequiredService(); var token = Environment.GetEnvironmentVariable("BOT_TOKEN"); if (token != null) { configuration["Discord:Token"] = token; } host.AddModules(typeof(Program).Assembly); host.RunAsync().GetAwaiter().GetResult(); } private static void AddActions(IServiceCollection services) { services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); } }