chore: format with csharpier
This commit is contained in:
parent
2f516dcb73
commit
4f54077c68
59 changed files with 2000 additions and 942 deletions
|
|
@ -18,27 +18,30 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
var config = builder.AddConfiguration();
|
||||
builder.AddSerilog(config);
|
||||
|
||||
builder.Services
|
||||
.AddControllers()
|
||||
.AddNewtonsoftJson(o => o.SerializerSettings.ContractResolver =
|
||||
new DefaultContractResolver
|
||||
builder
|
||||
.Services.AddControllers()
|
||||
.AddNewtonsoftJson(o =>
|
||||
o.SerializerSettings.ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
NamingStrategy = new SnakeCaseNamingStrategy()
|
||||
});
|
||||
NamingStrategy = new SnakeCaseNamingStrategy(),
|
||||
}
|
||||
);
|
||||
|
||||
builder.Host
|
||||
.AddShardedDiscordService(_ => config.Discord.Token)
|
||||
builder
|
||||
.Host.AddShardedDiscordService(_ => config.Discord.Token)
|
||||
.ConfigureServices(s =>
|
||||
s.AddRespondersFromAssembly(typeof(Program).Assembly)
|
||||
.Configure<DiscordGatewayClientOptions>(g =>
|
||||
g.Intents = GatewayIntents.Guilds |
|
||||
GatewayIntents.GuildBans |
|
||||
GatewayIntents.GuildInvites |
|
||||
GatewayIntents.GuildMembers |
|
||||
GatewayIntents.GuildMessages |
|
||||
GatewayIntents.GuildWebhooks |
|
||||
GatewayIntents.MessageContents |
|
||||
GatewayIntents.GuildEmojisAndStickers)
|
||||
g.Intents =
|
||||
GatewayIntents.Guilds
|
||||
| GatewayIntents.GuildBans
|
||||
| GatewayIntents.GuildInvites
|
||||
| GatewayIntents.GuildMembers
|
||||
| GatewayIntents.GuildMessages
|
||||
| GatewayIntents.GuildWebhooks
|
||||
| GatewayIntents.MessageContents
|
||||
| GatewayIntents.GuildEmojisAndStickers
|
||||
)
|
||||
.AddDiscordCommands(enableSlash: true, useDefaultCommandResponder: false)
|
||||
.AddCommandTree()
|
||||
// Start command tree
|
||||
|
|
@ -59,8 +62,8 @@ builder.Services.AddMetricServer(o => o.Port = (ushort)config.Logging.MetricsPor
|
|||
if (!config.Logging.EnableMetrics)
|
||||
builder.Services.AddHostedService<BackgroundMetricsCollectionService>();
|
||||
|
||||
builder.Services
|
||||
.AddDbContext<DatabaseContext>()
|
||||
builder
|
||||
.Services.AddDbContext<DatabaseContext>()
|
||||
.MaybeAddRedisCaches(config)
|
||||
.AddCustomServices()
|
||||
.AddEndpointsApiExplorer()
|
||||
|
|
@ -83,7 +86,8 @@ app.Urls.Add(config.Web.Address);
|
|||
|
||||
// Make sure metrics are updated whenever Prometheus scrapes them
|
||||
Metrics.DefaultRegistry.AddBeforeCollectCallback(async ct =>
|
||||
await app.Services.GetRequiredService<MetricsCollectionService>().CollectMetricsAsync(ct));
|
||||
await app.Services.GetRequiredService<MetricsCollectionService>().CollectMetricsAsync(ct)
|
||||
);
|
||||
|
||||
app.Run();
|
||||
Log.CloseAndFlush();
|
||||
Log.CloseAndFlush();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue