mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Factor DiscordConfiguration out into DI
This commit is contained in:
parent
35e30f481b
commit
9b6f79a508
1 changed files with 6 additions and 10 deletions
|
|
@ -16,18 +16,15 @@ namespace PluralKit.Bot
|
|||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
// Clients
|
||||
builder.Register(c => new DiscordShardedClient(new DiscordConfiguration
|
||||
builder.Register(c => new DiscordConfiguration
|
||||
{
|
||||
Token = c.Resolve<BotConfig>().Token,
|
||||
TokenType = TokenType.Bot,
|
||||
MessageCacheSize = 0,
|
||||
})).AsSelf().SingleInstance();
|
||||
builder.Register(c => new DiscordRestClient(new DiscordConfiguration
|
||||
{
|
||||
Token = c.Resolve<BotConfig>().Token,
|
||||
TokenType = TokenType.Bot,
|
||||
MessageCacheSize = 0,
|
||||
})).AsSelf().SingleInstance();
|
||||
LargeThreshold = 50
|
||||
}).AsSelf();
|
||||
builder.Register(c => new DiscordShardedClient(c.Resolve<DiscordConfiguration>())).AsSelf().SingleInstance();
|
||||
builder.Register(c => new DiscordRestClient(c.Resolve<DiscordConfiguration>())).AsSelf().SingleInstance();
|
||||
|
||||
// Commands
|
||||
builder.RegisterType<CommandTree>().AsSelf();
|
||||
|
|
@ -70,7 +67,6 @@ namespace PluralKit.Bot
|
|||
// Sentry stuff
|
||||
builder.Register(_ => new Scope(null)).AsSelf().InstancePerLifetimeScope();
|
||||
|
||||
|
||||
// Utils
|
||||
builder.Register(c => new HttpClient
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue